text
stringlengths 0
3.34M
|
---|
/-
Copyright (c) 2019 Sébastien Gouëzel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Jan-David Salchow, Sébastien Gouëzel, Jean Lo, Yury Kudryashov
-/
import Mathlib.PrePort
import Mathlib.Lean3Lib.init.default
import Mathlib.topology.algebra.ring
import Mathlib.topology.uniform_space.uniform_embedding
import Mathlib.algebra.algebra.basic
import Mathlib.linear_algebra.projection
import Mathlib.PostPort
universes u v l u_1 u_2 u_3 u_4 u_5
namespace Mathlib
/-!
# Theory of topological modules and continuous linear maps.
We define classes `topological_semimodule`, `topological_module` and `topological_vector_spaces`,
as extensions of the corresponding algebraic classes where the algebraic operations are continuous.
We also define continuous linear maps, as linear maps between topological modules which are
continuous. The set of continuous linear maps between the topological `R`-modules `M` and `M₂` is
denoted by `M →L[R] M₂`.
Continuous linear equivalences are denoted by `M ≃L[R] M₂`.
## Implementation notes
Topological vector spaces are defined as an `abbreviation` for topological modules,
if the base ring is a field. This has as advantage that topological vector spaces are completely
transparent for type class inference, which means that all instances for topological modules
are immediately picked up for vector spaces as well.
A cosmetic disadvantage is that one can not extend topological vector spaces.
The solution is to extend `topological_module` instead.
-/
/-- A topological semimodule, over a semiring which is also a topological space, is a
semimodule in which scalar multiplication is continuous. In applications, R will be a topological
semiring and M a topological additive semigroup, but this is not needed for the definition -/
class topological_semimodule (R : Type u) (M : Type v) [semiring R] [topological_space R] [topological_space M] [add_comm_monoid M] [semimodule R M]
where
continuous_smul : continuous fun (p : R × M) => prod.fst p • prod.snd p
theorem continuous_smul {R : Type u} {M : Type v} [semiring R] [topological_space R] [topological_space M] [add_comm_monoid M] [semimodule R M] [topological_semimodule R M] : continuous fun (p : R × M) => prod.fst p • prod.snd p :=
topological_semimodule.continuous_smul
theorem continuous.smul {R : Type u} {M : Type v} [semiring R] [topological_space R] [topological_space M] [add_comm_monoid M] [semimodule R M] [topological_semimodule R M] {α : Type u_1} [topological_space α] {f : α → R} {g : α → M} (hf : continuous f) (hg : continuous g) : continuous fun (p : α) => f p • g p :=
continuous.comp continuous_smul (continuous.prod_mk hf hg)
theorem tendsto_smul {R : Type u} {M : Type v} [semiring R] [topological_space R] [topological_space M] [add_comm_monoid M] [semimodule R M] [topological_semimodule R M] {c : R} {x : M} : filter.tendsto (fun (p : R × M) => prod.fst p • prod.snd p) (nhds (c, x)) (nhds (c • x)) :=
continuous.tendsto continuous_smul (c, x)
theorem filter.tendsto.smul {R : Type u} {M : Type v} [semiring R] [topological_space R] [topological_space M] [add_comm_monoid M] [semimodule R M] [topological_semimodule R M] {α : Type u_1} {l : filter α} {f : α → R} {g : α → M} {c : R} {x : M} (hf : filter.tendsto f l (nhds c)) (hg : filter.tendsto g l (nhds x)) : filter.tendsto (fun (a : α) => f a • g a) l (nhds (c • x)) :=
filter.tendsto.comp tendsto_smul (filter.tendsto.prod_mk_nhds hf hg)
protected instance topological_semiring.to_semimodule {R : Type u_1} [topological_space R] [semiring R] [topological_semiring R] : topological_semimodule R R :=
topological_semimodule.mk continuous_mul
/-- A topological module, over a ring which is also a topological space, is a module in which
scalar multiplication is continuous. In applications, `R` will be a topological ring and `M` a
topological additive group, but this is not needed for the definition -/
def topological_module (R : Type u) (M : Type v) [ring R] [topological_space R] [topological_space M] [add_comm_group M] [module R M] :=
topological_semimodule R M
/-- A topological vector space is a topological module over a field. -/
def topological_vector_space (R : Type u) (M : Type v) [field R] [topological_space R] [topological_space M] [add_comm_group M] [module R M] :=
topological_module R M
/-- Scalar multiplication by a unit is a homeomorphism from a
topological module onto itself. -/
protected def homeomorph.smul_of_unit {R : Type u_1} {M : Type u_2} [ring R] [topological_space R] [topological_space M] [add_comm_group M] [module R M] [topological_module R M] (a : units R) : M ≃ₜ M :=
homeomorph.mk (equiv.mk (fun (x : M) => ↑a • x) (fun (x : M) => ↑(a⁻¹) • x) sorry sorry)
theorem is_open_map_smul_of_unit {R : Type u_1} {M : Type u_2} [ring R] [topological_space R] [topological_space M] [add_comm_group M] [module R M] [topological_module R M] (a : units R) : is_open_map fun (x : M) => ↑a • x :=
homeomorph.is_open_map (homeomorph.smul_of_unit a)
theorem is_closed_map_smul_of_unit {R : Type u_1} {M : Type u_2} [ring R] [topological_space R] [topological_space M] [add_comm_group M] [module R M] [topological_module R M] (a : units R) : is_closed_map fun (x : M) => ↑a • x :=
homeomorph.is_closed_map (homeomorph.smul_of_unit a)
/-- If `M` is a topological module over `R` and `0` is a limit of invertible elements of `R`, then
`⊤` is the only submodule of `M` with a nonempty interior.
This is the case, e.g., if `R` is a nondiscrete normed field. -/
theorem submodule.eq_top_of_nonempty_interior' {R : Type u_1} {M : Type u_2} [ring R] [topological_space R] [topological_space M] [add_comm_group M] [module R M] [topological_module R M] [has_continuous_add M] [filter.ne_bot (nhds_within 0 (set_of fun (x : R) => is_unit x))] (s : submodule R M) (hs : set.nonempty (interior ↑s)) : s = ⊤ := sorry
theorem submodule.closure_smul_self_subset {R : Type u} {M : Type v} [semiring R] [topological_space R] [topological_space M] [add_comm_monoid M] [semimodule R M] [topological_semimodule R M] (s : submodule R M) : (fun (p : R × M) => prod.fst p • prod.snd p) '' set.prod set.univ (closure ↑s) ⊆ closure ↑s := sorry
theorem submodule.closure_smul_self_eq {R : Type u} {M : Type v} [semiring R] [topological_space R] [topological_space M] [add_comm_monoid M] [semimodule R M] [topological_semimodule R M] (s : submodule R M) : (fun (p : R × M) => prod.fst p • prod.snd p) '' set.prod set.univ (closure ↑s) = closure ↑s := sorry
/-- The (topological-space) closure of a submodle of a topological `R`-semimodule `M` is itself
a submodule. -/
def submodule.topological_closure {R : Type u} {M : Type v} [semiring R] [topological_space R] [topological_space M] [add_comm_monoid M] [semimodule R M] [topological_semimodule R M] [has_continuous_add M] (s : submodule R M) : submodule R M :=
submodule.mk (closure ↑s) sorry sorry sorry
theorem submodule.submodule_topological_closure {R : Type u} {M : Type v} [semiring R] [topological_space R] [topological_space M] [add_comm_monoid M] [semimodule R M] [topological_semimodule R M] [has_continuous_add M] (s : submodule R M) : s ≤ submodule.topological_closure s :=
subset_closure
theorem submodule.is_closed_topological_closure {R : Type u} {M : Type v} [semiring R] [topological_space R] [topological_space M] [add_comm_monoid M] [semimodule R M] [topological_semimodule R M] [has_continuous_add M] (s : submodule R M) : is_closed ↑(submodule.topological_closure s) := sorry
theorem submodule.topological_closure_minimal {R : Type u} {M : Type v} [semiring R] [topological_space R] [topological_space M] [add_comm_monoid M] [semimodule R M] [topological_semimodule R M] [has_continuous_add M] (s : submodule R M) {t : submodule R M} (h : s ≤ t) (ht : is_closed ↑t) : submodule.topological_closure s ≤ t :=
closure_minimal h ht
/-- Scalar multiplication by a non-zero field element is a
homeomorphism from a topological vector space onto itself. -/
protected def homeomorph.smul_of_ne_zero {R : Type u_1} {M : Type u_2} {a : R} [field R] [topological_space R] [topological_space M] [add_comm_group M] [vector_space R M] [topological_vector_space R M] (ha : a ≠ 0) : M ≃ₜ M :=
homeomorph.mk (homeomorph.to_equiv (homeomorph.smul_of_unit (units.mk0 a ha)))
theorem is_open_map_smul_of_ne_zero {R : Type u_1} {M : Type u_2} {a : R} [field R] [topological_space R] [topological_space M] [add_comm_group M] [vector_space R M] [topological_vector_space R M] (ha : a ≠ 0) : is_open_map fun (x : M) => a • x :=
homeomorph.is_open_map (homeomorph.smul_of_ne_zero ha)
/-- `smul` is a closed map in the second argument.
The lemma that `smul` is a closed map in the first argument (for a normed space over a complete
normed field) is `is_closed_map_smul_left` in `analysis.normed_space.finite_dimension`. -/
theorem is_closed_map_smul_of_ne_zero {R : Type u_1} {M : Type u_2} {a : R} [field R] [topological_space R] [topological_space M] [add_comm_group M] [vector_space R M] [topological_vector_space R M] (ha : a ≠ 0) : is_closed_map fun (x : M) => a • x :=
homeomorph.is_closed_map (homeomorph.smul_of_ne_zero ha)
/-- Continuous linear maps between modules. We only put the type classes that are necessary for the
definition, although in applications `M` and `M₂` will be topological modules over the topological
ring `R`. -/
structure continuous_linear_map (R : Type u_1) [semiring R] (M : Type u_2) [topological_space M] [add_comm_monoid M] (M₂ : Type u_3) [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂]
extends linear_map R M M₂
where
cont : autoParam (continuous (linear_map.to_fun _to_linear_map))
(Lean.Syntax.ident Lean.SourceInfo.none (String.toSubstring "Mathlib.tactic.interactive.continuity'")
(Lean.Name.mkStr
(Lean.Name.mkStr (Lean.Name.mkStr (Lean.Name.mkStr Lean.Name.anonymous "Mathlib") "tactic") "interactive")
"continuity'")
[])
/-- Continuous linear equivalences between modules. We only put the type classes that are necessary
for the definition, although in applications `M` and `M₂` will be topological modules over the
topological ring `R`. -/
structure continuous_linear_equiv (R : Type u_1) [semiring R] (M : Type u_2) [topological_space M] [add_comm_monoid M] (M₂ : Type u_3) [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂]
extends linear_equiv R M M₂
where
continuous_to_fun : autoParam (continuous (linear_equiv.to_fun _to_linear_equiv))
(Lean.Syntax.ident Lean.SourceInfo.none (String.toSubstring "Mathlib.tactic.interactive.continuity'")
(Lean.Name.mkStr
(Lean.Name.mkStr (Lean.Name.mkStr (Lean.Name.mkStr Lean.Name.anonymous "Mathlib") "tactic") "interactive")
"continuity'")
[])
continuous_inv_fun : autoParam (continuous (linear_equiv.inv_fun _to_linear_equiv))
(Lean.Syntax.ident Lean.SourceInfo.none (String.toSubstring "Mathlib.tactic.interactive.continuity'")
(Lean.Name.mkStr
(Lean.Name.mkStr (Lean.Name.mkStr (Lean.Name.mkStr Lean.Name.anonymous "Mathlib") "tactic") "interactive")
"continuity'")
[])
namespace continuous_linear_map
/-!
### Properties that hold for non-necessarily commutative semirings.
-/
/-- Coerce continuous linear maps to linear maps. -/
protected instance linear_map.has_coe {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : has_coe (continuous_linear_map R M M₂) (linear_map R M M₂) :=
has_coe.mk to_linear_map
/-- Coerce continuous linear maps to functions. -/
-- see Note [function coercion]
protected instance to_fun {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : has_coe_to_fun (continuous_linear_map R M M₂) :=
has_coe_to_fun.mk (fun (_x : continuous_linear_map R M M₂) => M → M₂) fun (f : continuous_linear_map R M M₂) => ⇑f
@[simp] theorem coe_mk {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : linear_map R M M₂) (h : autoParam (continuous (linear_map.to_fun f))
(Lean.Syntax.ident Lean.SourceInfo.none (String.toSubstring "Mathlib.tactic.interactive.continuity'")
(Lean.Name.mkStr
(Lean.Name.mkStr (Lean.Name.mkStr (Lean.Name.mkStr Lean.Name.anonymous "Mathlib") "tactic") "interactive")
"continuity'")
[])) : ↑(mk f) = f :=
rfl
@[simp] theorem coe_mk' {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : linear_map R M M₂) (h : autoParam (continuous (linear_map.to_fun f))
(Lean.Syntax.ident Lean.SourceInfo.none (String.toSubstring "Mathlib.tactic.interactive.continuity'")
(Lean.Name.mkStr
(Lean.Name.mkStr (Lean.Name.mkStr (Lean.Name.mkStr Lean.Name.anonymous "Mathlib") "tactic") "interactive")
"continuity'")
[])) : ⇑(mk f) = ⇑f :=
rfl
protected theorem continuous {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) : continuous ⇑f :=
cont f
theorem coe_injective {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : function.injective coe := sorry
theorem injective_coe_fn {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : function.injective fun (f : continuous_linear_map R M M₂) => (fun (this : M → M₂) => this) ⇑f :=
function.injective.comp linear_map.coe_injective coe_injective
theorem ext {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] {f : continuous_linear_map R M M₂} {g : continuous_linear_map R M M₂} (h : ∀ (x : M), coe_fn f x = coe_fn g x) : f = g :=
injective_coe_fn (funext h)
theorem ext_iff {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] {f : continuous_linear_map R M M₂} {g : continuous_linear_map R M M₂} : f = g ↔ ∀ (x : M), coe_fn f x = coe_fn g x :=
{ mp :=
fun (h : f = g) (x : M) => eq.mpr (id (Eq._oldrec (Eq.refl (coe_fn f x = coe_fn g x)) h)) (Eq.refl (coe_fn g x)),
mpr := ext }
-- make some straightforward lemmas available to `simp`.
@[simp] theorem map_zero {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) : coe_fn f 0 = 0 :=
linear_map.map_zero (to_linear_map f)
@[simp] theorem map_add {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (x : M) (y : M) : coe_fn f (x + y) = coe_fn f x + coe_fn f y :=
linear_map.map_add (to_linear_map f) x y
@[simp] theorem map_smul {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (c : R) (f : continuous_linear_map R M M₂) (x : M) : coe_fn f (c • x) = c • coe_fn f x :=
linear_map.map_smul (to_linear_map f) c x
theorem map_sum {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) {ι : Type u_4} (s : finset ι) (g : ι → M) : coe_fn f (finset.sum s fun (i : ι) => g i) = finset.sum s fun (i : ι) => coe_fn f (g i) :=
linear_map.map_sum (to_linear_map f)
@[simp] theorem coe_coe {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) : ⇑↑f = ⇑f :=
rfl
/-- If two continuous linear maps are equal on a set `s`, then they are equal on the closure
of the `submodule.span` of this set. -/
theorem eq_on_closure_span {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] [t2_space M₂] {s : set M} {f : continuous_linear_map R M M₂} {g : continuous_linear_map R M M₂} (h : set.eq_on (⇑f) (⇑g) s) : set.eq_on (⇑f) (⇑g) (closure ↑(submodule.span R s)) :=
set.eq_on.closure (linear_map.eq_on_span' h) (continuous_linear_map.continuous f) (continuous_linear_map.continuous g)
/-- If the submodule generated by a set `s` is dense in the ambient semimodule, then two continuous
linear maps equal on `s` are equal. -/
theorem ext_on {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] [t2_space M₂] {s : set M} (hs : dense ↑(submodule.span R s)) {f : continuous_linear_map R M M₂} {g : continuous_linear_map R M M₂} (h : set.eq_on (⇑f) (⇑g) s) : f = g :=
ext fun (x : M) => eq_on_closure_span h (hs x)
/-- The continuous map that is constantly zero. -/
protected instance has_zero {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : HasZero (continuous_linear_map R M M₂) :=
{ zero := mk 0 }
protected instance inhabited {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : Inhabited (continuous_linear_map R M M₂) :=
{ default := 0 }
@[simp] theorem default_def {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : Inhabited.default = 0 :=
rfl
@[simp] theorem zero_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (x : M) : coe_fn 0 x = 0 :=
rfl
/- no simp attribute on the next line as simp does not always simplify `0 x` to `0`
@[simp] theorem coe_zero {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : ↑0 = 0 :=
rfl
when `0` is the zero function, while it does for the zero continuous linear map,
and this is the most important property we care about. -/
theorem coe_zero' {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : ⇑0 = 0 :=
rfl
protected instance unique_of_left {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] [subsingleton M] : unique (continuous_linear_map R M M₂) :=
function.injective.unique coe_injective
protected instance unique_of_right {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] [subsingleton M₂] : unique (continuous_linear_map R M M₂) :=
function.injective.unique coe_injective
/-- the identity map as a continuous linear map. -/
def id (R : Type u_1) [semiring R] (M : Type u_2) [topological_space M] [add_comm_monoid M] [semimodule R M] : continuous_linear_map R M M :=
mk linear_map.id
protected instance has_one {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] : HasOne (continuous_linear_map R M M) :=
{ one := id R M }
theorem one_def {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] : 1 = id R M :=
rfl
theorem id_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] (x : M) : coe_fn (id R M) x = x :=
rfl
@[simp] theorem coe_id {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] : ↑(id R M) = linear_map.id :=
rfl
@[simp] theorem coe_id' {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] : ⇑(id R M) = id :=
rfl
@[simp] theorem one_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] (x : M) : coe_fn 1 x = x :=
rfl
protected instance has_add {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] [has_continuous_add M₂] : Add (continuous_linear_map R M M₂) :=
{ add := fun (f g : continuous_linear_map R M M₂) => mk (↑f + ↑g) }
@[simp] theorem add_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (g : continuous_linear_map R M M₂) (x : M) [has_continuous_add M₂] : coe_fn (f + g) x = coe_fn f x + coe_fn g x :=
rfl
@[simp] theorem coe_add {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (g : continuous_linear_map R M M₂) [has_continuous_add M₂] : ↑(f + g) = ↑f + ↑g :=
rfl
theorem coe_add' {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (g : continuous_linear_map R M M₂) [has_continuous_add M₂] : ⇑(f + g) = ⇑f + ⇑g :=
rfl
protected instance add_comm_monoid {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] [has_continuous_add M₂] : add_comm_monoid (continuous_linear_map R M M₂) :=
add_comm_monoid.mk Add.add sorry 0 sorry sorry sorry
theorem sum_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] [has_continuous_add M₂] {ι : Type u_4} (t : finset ι) (f : ι → continuous_linear_map R M M₂) (b : M) : coe_fn (finset.sum t fun (d : ι) => f d) b = finset.sum t fun (d : ι) => coe_fn (f d) b :=
Eq.symm (finset.sum_hom t fun (g : continuous_linear_map R M M₂) => coe_fn g b)
/-- Composition of bounded linear maps. -/
def comp {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (g : continuous_linear_map R M₂ M₃) (f : continuous_linear_map R M M₂) : continuous_linear_map R M M₃ :=
mk (linear_map.comp (to_linear_map g) (to_linear_map f))
@[simp] theorem coe_comp {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (f : continuous_linear_map R M M₂) (h : continuous_linear_map R M₂ M₃) : ↑(comp h f) = linear_map.comp ↑h ↑f :=
rfl
@[simp] theorem coe_comp' {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (f : continuous_linear_map R M M₂) (h : continuous_linear_map R M₂ M₃) : ⇑(comp h f) = ⇑h ∘ ⇑f :=
rfl
@[simp] theorem comp_id {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) : comp f (id R M) = f :=
ext fun (x : M) => rfl
@[simp] theorem id_comp {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) : comp (id R M₂) f = f :=
ext fun (x : M) => rfl
@[simp] theorem comp_zero {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (f : continuous_linear_map R M M₂) : comp f 0 = 0 := sorry
@[simp] theorem zero_comp {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (f : continuous_linear_map R M M₂) : comp 0 f = 0 := sorry
@[simp] theorem comp_add {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [has_continuous_add M₂] [has_continuous_add M₃] (g : continuous_linear_map R M₂ M₃) (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M M₂) : comp g (f₁ + f₂) = comp g f₁ + comp g f₂ := sorry
@[simp] theorem add_comp {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [has_continuous_add M₃] (g₁ : continuous_linear_map R M₂ M₃) (g₂ : continuous_linear_map R M₂ M₃) (f : continuous_linear_map R M M₂) : comp (g₁ + g₂) f = comp g₁ f + comp g₂ f := sorry
theorem comp_assoc {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] {M₄ : Type u_5} [topological_space M₄] [add_comm_monoid M₄] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [semimodule R M₄] (h : continuous_linear_map R M₃ M₄) (g : continuous_linear_map R M₂ M₃) (f : continuous_linear_map R M M₂) : comp (comp h g) f = comp h (comp g f) :=
rfl
protected instance has_mul {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] : Mul (continuous_linear_map R M M) :=
{ mul := comp }
theorem mul_def {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] (f : continuous_linear_map R M M) (g : continuous_linear_map R M M) : f * g = comp f g :=
rfl
@[simp] theorem coe_mul {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] (f : continuous_linear_map R M M) (g : continuous_linear_map R M M) : ⇑(f * g) = ⇑f ∘ ⇑g :=
rfl
theorem mul_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] (f : continuous_linear_map R M M) (g : continuous_linear_map R M M) (x : M) : coe_fn (f * g) x = coe_fn f (coe_fn g x) :=
rfl
/-- The cartesian product of two bounded linear maps, as a bounded linear map. -/
protected def prod {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M M₃) : continuous_linear_map R M (M₂ × M₃) :=
mk (linear_map.mk (linear_map.to_fun (linear_map.prod (to_linear_map f₁) (to_linear_map f₂))) sorry sorry)
@[simp] theorem coe_prod {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M M₃) : ↑(continuous_linear_map.prod f₁ f₂) = linear_map.prod ↑f₁ ↑f₂ :=
rfl
@[simp] theorem prod_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M M₃) (x : M) : coe_fn (continuous_linear_map.prod f₁ f₂) x = (coe_fn f₁ x, coe_fn f₂ x) :=
rfl
/-- Kernel of a continuous linear map. -/
def ker {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) : submodule R M :=
linear_map.ker ↑f
theorem ker_coe {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) : linear_map.ker ↑f = ker f :=
rfl
@[simp] theorem mem_ker {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] {f : continuous_linear_map R M M₂} {x : M} : x ∈ ker f ↔ coe_fn f x = 0 :=
linear_map.mem_ker
theorem is_closed_ker {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) [t1_space M₂] : is_closed ↑(ker f) :=
iff.mp continuous_iff_is_closed (cont f) (↑⊥) is_closed_singleton
@[simp] theorem apply_ker {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (x : ↥(ker f)) : coe_fn f ↑x = 0 :=
iff.mp mem_ker (subtype.property x)
theorem is_complete_ker {R : Type u_1} [semiring R] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M₂] {M' : Type u_2} [uniform_space M'] [complete_space M'] [add_comm_monoid M'] [semimodule R M'] [t1_space M₂] (f : continuous_linear_map R M' M₂) : is_complete ↑(ker f) :=
is_closed.is_complete (is_closed_ker f)
protected instance complete_space_ker {R : Type u_1} [semiring R] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M₂] {M' : Type u_2} [uniform_space M'] [complete_space M'] [add_comm_monoid M'] [semimodule R M'] [t1_space M₂] (f : continuous_linear_map R M' M₂) : complete_space ↥(ker f) :=
is_closed.complete_space_coe (is_closed_ker f)
@[simp] theorem ker_prod {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (f : continuous_linear_map R M M₂) (g : continuous_linear_map R M M₃) : ker (continuous_linear_map.prod f g) = ker f ⊓ ker g :=
linear_map.ker_prod ↑f ↑g
/-- Range of a continuous linear map. -/
def range {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) : submodule R M₂ :=
linear_map.range ↑f
theorem range_coe {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) : ↑(range f) = set.range ⇑f :=
linear_map.range_coe ↑f
theorem mem_range {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] {f : continuous_linear_map R M M₂} {y : M₂} : y ∈ range f ↔ ∃ (x : M), coe_fn f x = y :=
linear_map.mem_range
theorem range_prod_le {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (f : continuous_linear_map R M M₂) (g : continuous_linear_map R M M₃) : range (continuous_linear_map.prod f g) ≤ submodule.prod (range f) (range g) :=
linear_map.range_prod_le ↑f ↑g
/-- Restrict codomain of a continuous linear map. -/
def cod_restrict {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (p : submodule R M₂) (h : ∀ (x : M), coe_fn f x ∈ p) : continuous_linear_map R M ↥p :=
mk (linear_map.cod_restrict p (↑f) h)
theorem coe_cod_restrict {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (p : submodule R M₂) (h : ∀ (x : M), coe_fn f x ∈ p) : ↑(cod_restrict f p h) = linear_map.cod_restrict p (↑f) h :=
rfl
@[simp] theorem coe_cod_restrict_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (p : submodule R M₂) (h : ∀ (x : M), coe_fn f x ∈ p) (x : M) : ↑(coe_fn (cod_restrict f p h) x) = coe_fn f x :=
rfl
@[simp] theorem ker_cod_restrict {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (p : submodule R M₂) (h : ∀ (x : M), coe_fn f x ∈ p) : ker (cod_restrict f p h) = ker f :=
linear_map.ker_cod_restrict p (↑f) h
/-- Embedding of a submodule into the ambient space as a continuous linear map. -/
def subtype_val {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] (p : submodule R M) : continuous_linear_map R (↥p) M :=
mk (submodule.subtype p)
@[simp] theorem coe_subtype_val {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] (p : submodule R M) : ↑(subtype_val p) = submodule.subtype p :=
rfl
@[simp] theorem subtype_val_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] (p : submodule R M) (x : ↥p) : coe_fn (subtype_val p) x = ↑x :=
rfl
/-- `prod.fst` as a `continuous_linear_map`. -/
def fst (R : Type u_1) [semiring R] (M : Type u_2) [topological_space M] [add_comm_monoid M] (M₂ : Type u_3) [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : continuous_linear_map R (M × M₂) M :=
mk (linear_map.fst R M M₂)
/-- `prod.snd` as a `continuous_linear_map`. -/
def snd (R : Type u_1) [semiring R] (M : Type u_2) [topological_space M] [add_comm_monoid M] (M₂ : Type u_3) [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : continuous_linear_map R (M × M₂) M₂ :=
mk (linear_map.snd R M M₂)
@[simp] theorem coe_fst {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : ↑(fst R M M₂) = linear_map.fst R M M₂ :=
rfl
@[simp] theorem coe_fst' {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : ⇑(fst R M M₂) = prod.fst :=
rfl
@[simp] theorem coe_snd {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : ↑(snd R M M₂) = linear_map.snd R M M₂ :=
rfl
@[simp] theorem coe_snd' {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : ⇑(snd R M M₂) = prod.snd :=
rfl
@[simp] theorem fst_prod_snd {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : continuous_linear_map.prod (fst R M M₂) (snd R M M₂) = id R (M × M₂) := sorry
/-- `prod.map` of two continuous linear maps. -/
def prod_map {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] {M₄ : Type u_5} [topological_space M₄] [add_comm_monoid M₄] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [semimodule R M₄] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₃ M₄) : continuous_linear_map R (M × M₃) (M₂ × M₄) :=
continuous_linear_map.prod (comp f₁ (fst R M M₃)) (comp f₂ (snd R M M₃))
@[simp] theorem coe_prod_map {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] {M₄ : Type u_5} [topological_space M₄] [add_comm_monoid M₄] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [semimodule R M₄] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₃ M₄) : ↑(prod_map f₁ f₂) = linear_map.prod_map ↑f₁ ↑f₂ :=
rfl
@[simp] theorem coe_prod_map' {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] {M₄ : Type u_5} [topological_space M₄] [add_comm_monoid M₄] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [semimodule R M₄] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₃ M₄) : ⇑(prod_map f₁ f₂) = prod.map ⇑f₁ ⇑f₂ :=
rfl
/-- The continuous linear map given by `(x, y) ↦ f₁ x + f₂ y`. -/
def coprod {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [has_continuous_add M₃] (f₁ : continuous_linear_map R M M₃) (f₂ : continuous_linear_map R M₂ M₃) : continuous_linear_map R (M × M₂) M₃ :=
mk (linear_map.coprod ↑f₁ ↑f₂)
@[simp] theorem coe_coprod {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [has_continuous_add M₃] (f₁ : continuous_linear_map R M M₃) (f₂ : continuous_linear_map R M₂ M₃) : ↑(coprod f₁ f₂) = linear_map.coprod ↑f₁ ↑f₂ :=
rfl
@[simp] theorem coprod_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [has_continuous_add M₃] (f₁ : continuous_linear_map R M M₃) (f₂ : continuous_linear_map R M₂ M₃) (x : M × M₂) : coe_fn (coprod f₁ f₂) x = coe_fn f₁ (prod.fst x) + coe_fn f₂ (prod.snd x) :=
rfl
/-- The linear map `λ x, c x • f`. Associates to a scalar-valued linear map and an element of
`M₂` the `M₂`-valued linear map obtained by multiplying the two (a.k.a. tensoring by `M₂`).
See also `continuous_linear_map.smul_rightₗ` and `continuous_linear_map.smul_rightL`. -/
def smul_right {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] [topological_space R] [topological_semimodule R M₂] (c : continuous_linear_map R M R) (f : M₂) : continuous_linear_map R M M₂ :=
mk (linear_map.mk (linear_map.to_fun (linear_map.smul_right (to_linear_map c) f)) sorry sorry)
@[simp] theorem smul_right_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] [topological_space R] [topological_semimodule R M₂] {c : continuous_linear_map R M R} {f : M₂} {x : M} : coe_fn (smul_right c f) x = coe_fn c x • f :=
rfl
@[simp] theorem smul_right_one_one {R : Type u_1} [semiring R] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M₂] [topological_space R] [topological_semimodule R M₂] (c : continuous_linear_map R R M₂) : smul_right 1 (coe_fn c 1) = c := sorry
@[simp] theorem smul_right_one_eq_iff {R : Type u_1} [semiring R] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M₂] [topological_space R] [topological_semimodule R M₂] {f : M₂} {f' : M₂} : smul_right 1 f = smul_right 1 f' ↔ f = f' := sorry
theorem smul_right_comp {R : Type u_1} [semiring R] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M₂] [topological_space R] [topological_semimodule R M₂] [topological_semimodule R R] {x : M₂} {c : R} : comp (smul_right 1 x) (smul_right 1 c) = smul_right 1 (c • x) := sorry
/-- `pi` construction for continuous linear functions. From a family of continuous linear functions
it produces a continuous linear function into a family of topological modules. -/
def pi {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] {ι : Type u_4} {φ : ι → Type u_5} [(i : ι) → topological_space (φ i)] [(i : ι) → add_comm_monoid (φ i)] [(i : ι) → semimodule R (φ i)] (f : (i : ι) → continuous_linear_map R M (φ i)) : continuous_linear_map R M ((i : ι) → φ i) :=
mk (linear_map.pi fun (i : ι) => ↑(f i))
@[simp] theorem pi_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] {ι : Type u_4} {φ : ι → Type u_5} [(i : ι) → topological_space (φ i)] [(i : ι) → add_comm_monoid (φ i)] [(i : ι) → semimodule R (φ i)] (f : (i : ι) → continuous_linear_map R M (φ i)) (c : M) (i : ι) : coe_fn (pi f) c i = coe_fn (f i) c :=
rfl
theorem pi_eq_zero {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] {ι : Type u_4} {φ : ι → Type u_5} [(i : ι) → topological_space (φ i)] [(i : ι) → add_comm_monoid (φ i)] [(i : ι) → semimodule R (φ i)] (f : (i : ι) → continuous_linear_map R M (φ i)) : pi f = 0 ↔ ∀ (i : ι), f i = 0 := sorry
theorem pi_zero {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] {ι : Type u_4} {φ : ι → Type u_5} [(i : ι) → topological_space (φ i)] [(i : ι) → add_comm_monoid (φ i)] [(i : ι) → semimodule R (φ i)] : (pi fun (i : ι) => 0) = 0 :=
ext fun (x : M) => funext fun (x_1 : ι) => Eq.refl (coe_fn (pi fun (i : ι) => 0) x x_1)
theorem pi_comp {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M₂] {ι : Type u_4} {φ : ι → Type u_5} [(i : ι) → topological_space (φ i)] [(i : ι) → add_comm_monoid (φ i)] [(i : ι) → semimodule R (φ i)] (f : (i : ι) → continuous_linear_map R M (φ i)) (g : continuous_linear_map R M₂ M) : comp (pi f) g = pi fun (i : ι) => comp (f i) g :=
rfl
/-- The projections from a family of topological modules are continuous linear maps. -/
def proj {R : Type u_1} [semiring R] {ι : Type u_4} {φ : ι → Type u_5} [(i : ι) → topological_space (φ i)] [(i : ι) → add_comm_monoid (φ i)] [(i : ι) → semimodule R (φ i)] (i : ι) : continuous_linear_map R ((i : ι) → φ i) (φ i) :=
mk (linear_map.proj i)
@[simp] theorem proj_apply {R : Type u_1} [semiring R] {ι : Type u_4} {φ : ι → Type u_5} [(i : ι) → topological_space (φ i)] [(i : ι) → add_comm_monoid (φ i)] [(i : ι) → semimodule R (φ i)] (i : ι) (b : (i : ι) → φ i) : coe_fn (proj i) b = b i :=
rfl
theorem proj_pi {R : Type u_1} [semiring R] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M₂] {ι : Type u_4} {φ : ι → Type u_5} [(i : ι) → topological_space (φ i)] [(i : ι) → add_comm_monoid (φ i)] [(i : ι) → semimodule R (φ i)] (f : (i : ι) → continuous_linear_map R M₂ (φ i)) (i : ι) : comp (proj i) (pi f) = f i :=
ext fun (c : M₂) => rfl
theorem infi_ker_proj {R : Type u_1} [semiring R] {ι : Type u_4} {φ : ι → Type u_5} [(i : ι) → topological_space (φ i)] [(i : ι) → add_comm_monoid (φ i)] [(i : ι) → semimodule R (φ i)] : (infi fun (i : ι) => ker (proj i)) = ⊥ :=
linear_map.infi_ker_proj
/-- If `I` and `J` are complementary index sets, the product of the kernels of the `J`th projections of
`φ` is linearly equivalent to the product over `I`. -/
def infi_ker_proj_equiv (R : Type u_1) [semiring R] {ι : Type u_4} (φ : ι → Type u_5) [(i : ι) → topological_space (φ i)] [(i : ι) → add_comm_monoid (φ i)] [(i : ι) → semimodule R (φ i)] {I : set ι} {J : set ι} [decidable_pred fun (i : ι) => i ∈ I] (hd : disjoint I J) (hu : set.univ ⊆ I ∪ J) : continuous_linear_equiv R (↥(infi fun (i : ι) => infi fun (H : i ∈ J) => ker (proj i))) ((i : ↥I) → φ ↑i) :=
continuous_linear_equiv.mk (linear_map.infi_ker_proj_equiv R φ hd hu)
@[simp] theorem map_neg {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (x : M) : coe_fn f (-x) = -coe_fn f x :=
linear_map.map_neg (to_linear_map f) x
@[simp] theorem map_sub {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (x : M) (y : M) : coe_fn f (x - y) = coe_fn f x - coe_fn f y :=
linear_map.map_sub (to_linear_map f) x y
@[simp] theorem sub_apply' {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (g : continuous_linear_map R M M₂) (x : M) : coe_fn (↑f - ↑g) x = coe_fn f x - coe_fn g x :=
rfl
theorem range_prod_eq {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_group M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] {f : continuous_linear_map R M M₂} {g : continuous_linear_map R M M₃} (h : ker f ⊔ ker g = ⊤) : range (continuous_linear_map.prod f g) = submodule.prod (range f) (range g) :=
linear_map.range_prod_eq h
protected instance has_neg {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] [topological_add_group M₂] : Neg (continuous_linear_map R M M₂) :=
{ neg := fun (f : continuous_linear_map R M M₂) => mk (-↑f) }
@[simp] theorem neg_apply {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (x : M) [topological_add_group M₂] : coe_fn (-f) x = -coe_fn f x :=
rfl
@[simp] theorem coe_neg {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) [topological_add_group M₂] : ↑(-f) = -↑f :=
rfl
theorem coe_neg' {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) [topological_add_group M₂] : ⇑(-f) = -⇑f :=
rfl
protected instance has_sub {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] [topological_add_group M₂] : Sub (continuous_linear_map R M M₂) :=
{ sub := fun (f g : continuous_linear_map R M M₂) => mk (↑f - ↑g) }
protected instance add_comm_group {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] [topological_add_group M₂] : add_comm_group (continuous_linear_map R M M₂) :=
add_comm_group.mk Add.add sorry 0 sorry sorry Neg.neg Sub.sub sorry sorry
theorem sub_apply {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (g : continuous_linear_map R M M₂) [topological_add_group M₂] (x : M) : coe_fn (f - g) x = coe_fn f x - coe_fn g x :=
rfl
@[simp] theorem coe_sub {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (g : continuous_linear_map R M M₂) [topological_add_group M₂] : ↑(f - g) = ↑f - ↑g :=
rfl
@[simp] theorem coe_sub' {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_map R M M₂) (g : continuous_linear_map R M M₂) [topological_add_group M₂] : ⇑(f - g) = ⇑f - ⇑g :=
rfl
protected instance ring {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] [semimodule R M] [topological_add_group M] : ring (continuous_linear_map R M M) :=
ring.mk add_comm_group.add sorry add_comm_group.zero sorry sorry add_comm_group.neg add_comm_group.sub sorry sorry
Mul.mul sorry 1 sorry sorry sorry sorry
theorem smul_right_one_pow {R : Type u_1} [ring R] [topological_space R] [topological_add_group R] [topological_semimodule R R] (c : R) (n : ℕ) : smul_right 1 c ^ n = smul_right 1 (c ^ n) := sorry
/-- Given a right inverse `f₂ : M₂ →L[R] M` to `f₁ : M →L[R] M₂`,
`proj_ker_of_right_inverse f₁ f₂ h` is the projection `M →L[R] f₁.ker` along `f₂.range`. -/
def proj_ker_of_right_inverse {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] [topological_add_group M] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₂ M) (h : function.right_inverse ⇑f₂ ⇑f₁) : continuous_linear_map R M ↥(ker f₁) :=
cod_restrict (id R M - comp f₂ f₁) (ker f₁) sorry
@[simp] theorem coe_proj_ker_of_right_inverse_apply {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] [topological_add_group M] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₂ M) (h : function.right_inverse ⇑f₂ ⇑f₁) (x : M) : ↑(coe_fn (proj_ker_of_right_inverse f₁ f₂ h) x) = x - coe_fn f₂ (coe_fn f₁ x) :=
rfl
@[simp] theorem proj_ker_of_right_inverse_apply_idem {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] [topological_add_group M] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₂ M) (h : function.right_inverse ⇑f₂ ⇑f₁) (x : ↥(ker f₁)) : coe_fn (proj_ker_of_right_inverse f₁ f₂ h) ↑x = x := sorry
@[simp] theorem proj_ker_of_right_inverse_comp_inv {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M] [semimodule R M₂] [topological_add_group M] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₂ M) (h : function.right_inverse ⇑f₂ ⇑f₁) (y : M₂) : coe_fn (proj_ker_of_right_inverse f₁ f₂ h) (coe_fn f₂ y) = 0 := sorry
protected instance has_scalar {R : Type u_1} [comm_ring R] [topological_space R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₃ : Type u_4} [topological_space M₃] [add_comm_group M₃] [module R M] [module R M₃] [topological_module R M₃] : has_scalar R (continuous_linear_map R M M₃) :=
has_scalar.mk fun (c : R) (f : continuous_linear_map R M M₃) => mk (c • ↑f)
@[simp] theorem smul_comp {R : Type u_1} [comm_ring R] [topological_space R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_group M₃] [module R M] [module R M₂] [module R M₃] [topological_module R M₃] (c : R) (h : continuous_linear_map R M₂ M₃) (f : continuous_linear_map R M M₂) : comp (c • h) f = c • comp h f :=
rfl
@[simp] theorem smul_apply {R : Type u_1} [comm_ring R] [topological_space R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [module R M] [module R M₂] (c : R) (f : continuous_linear_map R M M₂) (x : M) [topological_module R M₂] : coe_fn (c • f) x = c • coe_fn f x :=
rfl
@[simp] theorem coe_apply {R : Type u_1} [comm_ring R] [topological_space R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [module R M] [module R M₂] (c : R) (f : continuous_linear_map R M M₂) [topological_module R M₂] : ↑(c • f) = c • ↑f :=
rfl
theorem coe_apply' {R : Type u_1} [comm_ring R] [topological_space R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [module R M] [module R M₂] (c : R) (f : continuous_linear_map R M M₂) [topological_module R M₂] : ⇑(c • f) = c • ⇑f :=
rfl
@[simp] theorem comp_smul {R : Type u_1} [comm_ring R] [topological_space R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_group M₃] [module R M] [module R M₂] [module R M₃] [topological_module R M₃] (c : R) (h : continuous_linear_map R M₂ M₃) (f : continuous_linear_map R M M₂) [topological_module R M₂] : comp h (c • f) = c • comp h f := sorry
protected instance module {R : Type u_1} [comm_ring R] [topological_space R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [module R M] [module R M₂] [topological_module R M₂] [topological_add_group M₂] : module R (continuous_linear_map R M M₂) :=
semimodule.mk sorry sorry
protected instance algebra {R : Type u_1} [comm_ring R] [topological_space R] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [module R M₂] [topological_module R M₂] [topological_add_group M₂] : algebra R (continuous_linear_map R M₂ M₂) :=
algebra.of_semimodule' sorry sorry
/-- Given `c : E →L[𝕜] 𝕜`, `c.smul_rightₗ` is the linear map from `F` to `E →L[𝕜] F`
sending `f` to `λ e, c e • f`. See also `continuous_linear_map.smul_rightL`. -/
def smul_rightₗ {R : Type u_1} [comm_ring R] [topological_space R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [module R M] [module R M₂] [topological_module R M₂] [topological_add_group M₂] (c : continuous_linear_map R M R) : linear_map R M₂ (continuous_linear_map R M M₂) :=
linear_map.mk (smul_right c) sorry sorry
end continuous_linear_map
namespace continuous_linear_equiv
/-- A continuous linear equivalence induces a continuous linear map. -/
def to_continuous_linear_map {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : continuous_linear_map R M M₂ :=
continuous_linear_map.mk
(linear_map.mk (linear_map.to_fun (linear_equiv.to_linear_map (to_linear_equiv e))) sorry sorry)
/-- Coerce continuous linear equivs to continuous linear maps. -/
protected instance continuous_linear_map.has_coe {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : has_coe (continuous_linear_equiv R M M₂) (continuous_linear_map R M M₂) :=
has_coe.mk to_continuous_linear_map
/-- Coerce continuous linear equivs to maps. -/
-- see Note [function coercion]
protected instance has_coe_to_fun {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] : has_coe_to_fun (continuous_linear_equiv R M M₂) :=
has_coe_to_fun.mk (fun (_x : continuous_linear_equiv R M M₂) => M → M₂) fun (f : continuous_linear_equiv R M M₂) => ⇑f
@[simp] theorem coe_def_rev {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : to_continuous_linear_map e = ↑e :=
rfl
@[simp] theorem coe_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) (b : M) : coe_fn (↑e) b = coe_fn e b :=
rfl
@[simp] theorem coe_to_linear_equiv {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f : continuous_linear_equiv R M M₂) : ⇑(to_linear_equiv f) = ⇑f :=
rfl
theorem coe_coe {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : ⇑↑e = ⇑e :=
rfl
theorem ext {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] {f : continuous_linear_equiv R M M₂} {g : continuous_linear_equiv R M M₂} (h : ⇑f = ⇑g) : f = g := sorry
/-- A continuous linear equivalence induces a homeomorphism. -/
def to_homeomorph {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : M ≃ₜ M₂ :=
homeomorph.mk
(equiv.mk (linear_equiv.to_fun (to_linear_equiv e)) (linear_equiv.inv_fun (to_linear_equiv e)) sorry sorry)
-- Make some straightforward lemmas available to `simp`.
@[simp] theorem map_zero {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : coe_fn e 0 = 0 :=
continuous_linear_map.map_zero ↑e
@[simp] theorem map_add {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) (x : M) (y : M) : coe_fn e (x + y) = coe_fn e x + coe_fn e y :=
continuous_linear_map.map_add (↑e) x y
@[simp] theorem map_smul {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) (c : R) (x : M) : coe_fn e (c • x) = c • coe_fn e x :=
continuous_linear_map.map_smul c (↑e) x
@[simp] theorem map_eq_zero_iff {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) {x : M} : coe_fn e x = 0 ↔ x = 0 :=
linear_equiv.map_eq_zero_iff (to_linear_equiv e)
protected theorem continuous {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : continuous ⇑e :=
continuous_to_fun e
protected theorem continuous_on {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) {s : set M} : continuous_on (⇑e) s :=
continuous.continuous_on (continuous_linear_equiv.continuous e)
protected theorem continuous_at {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) {x : M} : continuous_at (⇑e) x :=
continuous.continuous_at (continuous_linear_equiv.continuous e)
protected theorem continuous_within_at {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) {s : set M} {x : M} : continuous_within_at (⇑e) s x :=
continuous.continuous_within_at (continuous_linear_equiv.continuous e)
theorem comp_continuous_on_iff {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] {α : Type u_4} [topological_space α] (e : continuous_linear_equiv R M M₂) {f : α → M} {s : set α} : continuous_on (⇑e ∘ f) s ↔ continuous_on f s :=
homeomorph.comp_continuous_on_iff (to_homeomorph e) f s
theorem comp_continuous_iff {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] {α : Type u_4} [topological_space α] (e : continuous_linear_equiv R M M₂) {f : α → M} : continuous (⇑e ∘ f) ↔ continuous f :=
homeomorph.comp_continuous_iff (to_homeomorph e)
/-- An extensionality lemma for `R ≃L[R] M`. -/
theorem ext₁ {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] [topological_space R] {f : continuous_linear_equiv R R M} {g : continuous_linear_equiv R R M} (h : coe_fn f 1 = coe_fn g 1) : f = g := sorry
/-- The identity map as a continuous linear equivalence. -/
protected def refl (R : Type u_1) [semiring R] (M : Type u_2) [topological_space M] [add_comm_monoid M] [semimodule R M] : continuous_linear_equiv R M M :=
mk
(linear_equiv.mk (linear_equiv.to_fun (linear_equiv.refl R M)) sorry sorry
(linear_equiv.inv_fun (linear_equiv.refl R M)) sorry sorry)
@[simp] theorem coe_refl {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] : ↑(continuous_linear_equiv.refl R M) = continuous_linear_map.id R M :=
rfl
@[simp] theorem coe_refl' {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] : ⇑(continuous_linear_equiv.refl R M) = id :=
rfl
/-- The inverse of a continuous linear equivalence as a continuous linear equivalence-/
protected def symm {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : continuous_linear_equiv R M₂ M :=
mk
(linear_equiv.mk (linear_equiv.to_fun (linear_equiv.symm (to_linear_equiv e))) sorry sorry
(linear_equiv.inv_fun (linear_equiv.symm (to_linear_equiv e))) sorry sorry)
@[simp] theorem symm_to_linear_equiv {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : to_linear_equiv (continuous_linear_equiv.symm e) = linear_equiv.symm (to_linear_equiv e) :=
linear_equiv.ext fun (x : M₂) => Eq.refl (coe_fn (to_linear_equiv (continuous_linear_equiv.symm e)) x)
/-- The composition of two continuous linear equivalences as a continuous linear equivalence. -/
protected def trans {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (e₁ : continuous_linear_equiv R M M₂) (e₂ : continuous_linear_equiv R M₂ M₃) : continuous_linear_equiv R M M₃ :=
mk
(linear_equiv.mk (linear_equiv.to_fun (linear_equiv.trans (to_linear_equiv e₁) (to_linear_equiv e₂))) sorry sorry
(linear_equiv.inv_fun (linear_equiv.trans (to_linear_equiv e₁) (to_linear_equiv e₂))) sorry sorry)
@[simp] theorem trans_to_linear_equiv {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (e₁ : continuous_linear_equiv R M M₂) (e₂ : continuous_linear_equiv R M₂ M₃) : to_linear_equiv (continuous_linear_equiv.trans e₁ e₂) = linear_equiv.trans (to_linear_equiv e₁) (to_linear_equiv e₂) :=
linear_equiv.ext fun (x : M) => Eq.refl (coe_fn (to_linear_equiv (continuous_linear_equiv.trans e₁ e₂)) x)
/-- Product of two continuous linear equivalences. The map comes from `equiv.prod_congr`. -/
def prod {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] {M₄ : Type u_5} [topological_space M₄] [add_comm_monoid M₄] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [semimodule R M₄] (e : continuous_linear_equiv R M M₂) (e' : continuous_linear_equiv R M₃ M₄) : continuous_linear_equiv R (M × M₃) (M₂ × M₄) :=
mk
(linear_equiv.mk (linear_equiv.to_fun (linear_equiv.prod (to_linear_equiv e) (to_linear_equiv e'))) sorry sorry
(linear_equiv.inv_fun (linear_equiv.prod (to_linear_equiv e) (to_linear_equiv e'))) sorry sorry)
@[simp] theorem prod_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] {M₄ : Type u_5} [topological_space M₄] [add_comm_monoid M₄] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [semimodule R M₄] (e : continuous_linear_equiv R M M₂) (e' : continuous_linear_equiv R M₃ M₄) (x : M × M₃) : coe_fn (prod e e') x = (coe_fn e (prod.fst x), coe_fn e' (prod.snd x)) :=
rfl
@[simp] theorem coe_prod {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] {M₄ : Type u_5} [topological_space M₄] [add_comm_monoid M₄] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [semimodule R M₄] (e : continuous_linear_equiv R M M₂) (e' : continuous_linear_equiv R M₃ M₄) : ↑(prod e e') = continuous_linear_map.prod_map ↑e ↑e' :=
rfl
theorem bijective {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : function.bijective ⇑e :=
equiv.bijective (linear_equiv.to_equiv (to_linear_equiv e))
theorem injective {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : function.injective ⇑e :=
equiv.injective (linear_equiv.to_equiv (to_linear_equiv e))
theorem surjective {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : function.surjective ⇑e :=
equiv.surjective (linear_equiv.to_equiv (to_linear_equiv e))
@[simp] theorem trans_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (e₁ : continuous_linear_equiv R M M₂) (e₂ : continuous_linear_equiv R M₂ M₃) (c : M) : coe_fn (continuous_linear_equiv.trans e₁ e₂) c = coe_fn e₂ (coe_fn e₁ c) :=
rfl
@[simp] theorem apply_symm_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) (c : M₂) : coe_fn e (coe_fn (continuous_linear_equiv.symm e) c) = c :=
linear_equiv.right_inv (to_linear_equiv e) c
@[simp] theorem symm_apply_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) (b : M) : coe_fn (continuous_linear_equiv.symm e) (coe_fn e b) = b :=
linear_equiv.left_inv (to_linear_equiv e) b
@[simp] theorem symm_trans_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (e₁ : continuous_linear_equiv R M₂ M) (e₂ : continuous_linear_equiv R M₃ M₂) (c : M) : coe_fn (continuous_linear_equiv.symm (continuous_linear_equiv.trans e₂ e₁)) c =
coe_fn (continuous_linear_equiv.symm e₂) (coe_fn (continuous_linear_equiv.symm e₁) c) :=
rfl
@[simp] theorem comp_coe {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_monoid M₃] [semimodule R M] [semimodule R M₂] [semimodule R M₃] (f : continuous_linear_equiv R M M₂) (f' : continuous_linear_equiv R M₂ M₃) : continuous_linear_map.comp ↑f' ↑f = ↑(continuous_linear_equiv.trans f f') :=
rfl
@[simp] theorem coe_comp_coe_symm {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : continuous_linear_map.comp ↑e ↑(continuous_linear_equiv.symm e) = continuous_linear_map.id R M₂ :=
continuous_linear_map.ext (apply_symm_apply e)
@[simp] theorem coe_symm_comp_coe {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : continuous_linear_map.comp ↑(continuous_linear_equiv.symm e) ↑e = continuous_linear_map.id R M :=
continuous_linear_map.ext (symm_apply_apply e)
theorem symm_comp_self {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : ⇑(continuous_linear_equiv.symm e) ∘ ⇑e = id :=
funext fun (x : M) => symm_apply_apply e x
theorem self_comp_symm {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : ⇑e ∘ ⇑(continuous_linear_equiv.symm e) = id :=
funext fun (x : M₂) => apply_symm_apply e x
@[simp] theorem symm_comp_self' {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : ⇑↑(continuous_linear_equiv.symm e) ∘ ⇑↑e = id :=
symm_comp_self e
@[simp] theorem self_comp_symm' {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : ⇑↑e ∘ ⇑↑(continuous_linear_equiv.symm e) = id :=
self_comp_symm e
@[simp] theorem symm_symm {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) : continuous_linear_equiv.symm (continuous_linear_equiv.symm e) = e :=
ext (funext fun (x : M) => Eq.refl (coe_fn (continuous_linear_equiv.symm (continuous_linear_equiv.symm e)) x))
@[simp] theorem refl_symm {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] [semimodule R M] : continuous_linear_equiv.symm (continuous_linear_equiv.refl R M) = continuous_linear_equiv.refl R M :=
rfl
theorem symm_symm_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) (x : M) : coe_fn (continuous_linear_equiv.symm (continuous_linear_equiv.symm e)) x = coe_fn e x :=
rfl
theorem symm_apply_eq {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) {x : M₂} {y : M} : coe_fn (continuous_linear_equiv.symm e) x = y ↔ x = coe_fn e y :=
linear_equiv.symm_apply_eq (to_linear_equiv e)
theorem eq_symm_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) {x : M₂} {y : M} : y = coe_fn (continuous_linear_equiv.symm e) x ↔ coe_fn e y = x :=
linear_equiv.eq_symm_apply (to_linear_equiv e)
/-- Create a `continuous_linear_equiv` from two `continuous_linear_map`s that are
inverse of each other. -/
def equiv_of_inverse {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₂ M) (h₁ : function.left_inverse ⇑f₂ ⇑f₁) (h₂ : function.right_inverse ⇑f₂ ⇑f₁) : continuous_linear_equiv R M M₂ :=
mk (linear_equiv.mk ⇑f₁ sorry sorry (⇑f₂) h₁ h₂)
@[simp] theorem equiv_of_inverse_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₂ M) (h₁ : function.left_inverse ⇑f₂ ⇑f₁) (h₂ : function.right_inverse ⇑f₂ ⇑f₁) (x : M) : coe_fn (equiv_of_inverse f₁ f₂ h₁ h₂) x = coe_fn f₁ x :=
rfl
@[simp] theorem symm_equiv_of_inverse {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_monoid M] {M₂ : Type u_3} [topological_space M₂] [add_comm_monoid M₂] [semimodule R M] [semimodule R M₂] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₂ M) (h₁ : function.left_inverse ⇑f₂ ⇑f₁) (h₂ : function.right_inverse ⇑f₂ ⇑f₁) : continuous_linear_equiv.symm (equiv_of_inverse f₁ f₂ h₁ h₂) = equiv_of_inverse f₂ f₁ h₂ h₁ :=
rfl
/-- The continuous linear equivalences from `M` to itself form a group under composition. -/
protected instance automorphism_group {R : Type u_1} [semiring R] (M : Type u_2) [topological_space M] [add_comm_monoid M] [semimodule R M] : group (continuous_linear_equiv R M M) :=
group.mk (fun (f g : continuous_linear_equiv R M M) => continuous_linear_equiv.trans g f) sorry
(continuous_linear_equiv.refl R M) sorry sorry
(fun (f : continuous_linear_equiv R M M) => continuous_linear_equiv.symm f)
(div_inv_monoid.div._default (fun (f g : continuous_linear_equiv R M M) => continuous_linear_equiv.trans g f) sorry
(continuous_linear_equiv.refl R M) sorry sorry
fun (f : continuous_linear_equiv R M M) => continuous_linear_equiv.symm f)
sorry
/-- Equivalence given by a block lower diagonal matrix. `e` and `e'` are diagonal square blocks,
and `f` is a rectangular block below the diagonal. -/
def skew_prod {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_group M₃] {M₄ : Type u_5} [topological_space M₄] [add_comm_group M₄] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [semimodule R M₄] [topological_add_group M₄] (e : continuous_linear_equiv R M M₂) (e' : continuous_linear_equiv R M₃ M₄) (f : continuous_linear_map R M M₄) : continuous_linear_equiv R (M × M₃) (M₂ × M₄) :=
mk
(linear_equiv.mk (linear_equiv.to_fun (linear_equiv.skew_prod (to_linear_equiv e) (to_linear_equiv e') ↑f)) sorry
sorry (linear_equiv.inv_fun (linear_equiv.skew_prod (to_linear_equiv e) (to_linear_equiv e') ↑f)) sorry sorry)
@[simp] theorem skew_prod_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_group M₃] {M₄ : Type u_5} [topological_space M₄] [add_comm_group M₄] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [semimodule R M₄] [topological_add_group M₄] (e : continuous_linear_equiv R M M₂) (e' : continuous_linear_equiv R M₃ M₄) (f : continuous_linear_map R M M₄) (x : M × M₃) : coe_fn (skew_prod e e' f) x = (coe_fn e (prod.fst x), coe_fn e' (prod.snd x) + coe_fn f (prod.fst x)) :=
rfl
@[simp] theorem skew_prod_symm_apply {R : Type u_1} [semiring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] {M₃ : Type u_4} [topological_space M₃] [add_comm_group M₃] {M₄ : Type u_5} [topological_space M₄] [add_comm_group M₄] [semimodule R M] [semimodule R M₂] [semimodule R M₃] [semimodule R M₄] [topological_add_group M₄] (e : continuous_linear_equiv R M M₂) (e' : continuous_linear_equiv R M₃ M₄) (f : continuous_linear_map R M M₄) (x : M₂ × M₄) : coe_fn (continuous_linear_equiv.symm (skew_prod e e' f)) x =
(coe_fn (continuous_linear_equiv.symm e) (prod.fst x),
coe_fn (continuous_linear_equiv.symm e')
(prod.snd x - coe_fn f (coe_fn (continuous_linear_equiv.symm e) (prod.fst x)))) :=
rfl
@[simp] theorem map_sub {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] [semimodule R M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) (x : M) (y : M) : coe_fn e (x - y) = coe_fn e x - coe_fn e y :=
continuous_linear_map.map_sub (↑e) x y
@[simp] theorem map_neg {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] [semimodule R M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M₂] (e : continuous_linear_equiv R M M₂) (x : M) : coe_fn e (-x) = -coe_fn e x :=
continuous_linear_map.map_neg (↑e) x
/-! The next theorems cover the identification between `M ≃L[𝕜] M`and the group of units of the ring
`M →L[R] M`. -/
/-- An invertible continuous linear map `f` determines a continuous equivalence from `M` to itself.
-/
def of_unit {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] [semimodule R M] [topological_add_group M] (f : units (continuous_linear_map R M M)) : continuous_linear_equiv R M M :=
mk (linear_equiv.mk ⇑(units.val f) sorry sorry ⇑(units.inv f) sorry sorry)
/-- A continuous equivalence from `M` to itself determines an invertible continuous linear map. -/
def to_unit {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] [semimodule R M] [topological_add_group M] (f : continuous_linear_equiv R M M) : units (continuous_linear_map R M M) :=
units.mk ↑f ↑(continuous_linear_equiv.symm f) sorry sorry
/-- The units of the algebra of continuous `R`-linear endomorphisms of `M` is multiplicatively
equivalent to the type of continuous linear equivalences between `M` and itself. -/
def units_equiv (R : Type u_1) [ring R] (M : Type u_2) [topological_space M] [add_comm_group M] [semimodule R M] [topological_add_group M] : units (continuous_linear_map R M M) ≃* continuous_linear_equiv R M M :=
mul_equiv.mk of_unit to_unit sorry sorry sorry
@[simp] theorem units_equiv_apply (R : Type u_1) [ring R] (M : Type u_2) [topological_space M] [add_comm_group M] [semimodule R M] [topological_add_group M] (f : units (continuous_linear_map R M M)) (x : M) : coe_fn (coe_fn (units_equiv R M) f) x = coe_fn f x :=
rfl
/-- Continuous linear equivalences `R ≃L[R] R` are enumerated by `units R`. -/
def units_equiv_aut (R : Type u_1) [ring R] [topological_space R] [topological_module R R] : units R ≃ continuous_linear_equiv R R R :=
equiv.mk
(fun (u : units R) =>
equiv_of_inverse (continuous_linear_map.smul_right 1 ↑u) (continuous_linear_map.smul_right 1 ↑(u⁻¹)) sorry sorry)
(fun (e : continuous_linear_equiv R R R) =>
units.mk (coe_fn e 1) (coe_fn (continuous_linear_equiv.symm e) 1) sorry sorry)
sorry sorry
@[simp] theorem units_equiv_aut_apply {R : Type u_1} [ring R] [topological_space R] [topological_module R R] (u : units R) (x : R) : coe_fn (coe_fn (units_equiv_aut R) u) x = x * ↑u :=
rfl
@[simp] theorem units_equiv_aut_apply_symm {R : Type u_1} [ring R] [topological_space R] [topological_module R R] (u : units R) (x : R) : coe_fn (continuous_linear_equiv.symm (coe_fn (units_equiv_aut R) u)) x = x * ↑(u⁻¹) :=
rfl
@[simp] theorem units_equiv_aut_symm_apply {R : Type u_1} [ring R] [topological_space R] [topological_module R R] (e : continuous_linear_equiv R R R) : ↑(coe_fn (equiv.symm (units_equiv_aut R)) e) = coe_fn e 1 :=
rfl
/-- A pair of continuous linear maps such that `f₁ ∘ f₂ = id` generates a continuous
linear equivalence `e` between `M` and `M₂ × f₁.ker` such that `(e x).2 = x` for `x ∈ f₁.ker`,
`(e x).1 = f₁ x`, and `(e (f₂ y)).2 = 0`. The map is given by `e x = (f₁ x, x - f₂ (f₁ x))`. -/
def equiv_of_right_inverse {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] [semimodule R M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M₂] [topological_add_group M] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₂ M) (h : function.right_inverse ⇑f₂ ⇑f₁) : continuous_linear_equiv R M (M₂ × ↥(continuous_linear_map.ker f₁)) :=
equiv_of_inverse (continuous_linear_map.prod f₁ (continuous_linear_map.proj_ker_of_right_inverse f₁ f₂ h))
(continuous_linear_map.coprod f₂ (continuous_linear_map.subtype_val (continuous_linear_map.ker f₁))) sorry sorry
@[simp] theorem fst_equiv_of_right_inverse {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] [semimodule R M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M₂] [topological_add_group M] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₂ M) (h : function.right_inverse ⇑f₂ ⇑f₁) (x : M) : prod.fst (coe_fn (equiv_of_right_inverse f₁ f₂ h) x) = coe_fn f₁ x :=
rfl
@[simp] theorem snd_equiv_of_right_inverse {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] [semimodule R M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M₂] [topological_add_group M] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₂ M) (h : function.right_inverse ⇑f₂ ⇑f₁) (x : M) : ↑(prod.snd (coe_fn (equiv_of_right_inverse f₁ f₂ h) x)) = x - coe_fn f₂ (coe_fn f₁ x) :=
rfl
@[simp] theorem equiv_of_right_inverse_symm_apply {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] [semimodule R M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [semimodule R M₂] [topological_add_group M] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₂ M) (h : function.right_inverse ⇑f₂ ⇑f₁) (y : M₂ × ↥(continuous_linear_map.ker f₁)) : coe_fn (continuous_linear_equiv.symm (equiv_of_right_inverse f₁ f₂ h)) y = coe_fn f₂ (prod.fst y) + ↑(prod.snd y) :=
rfl
end continuous_linear_equiv
namespace continuous_linear_map
/-- Introduce a function `inverse` from `M →L[R] M₂` to `M₂ →L[R] M`, which sends `f` to `f.symm` if
`f` is a continuous linear equivalence and to `0` otherwise. This definition is somewhat ad hoc,
but one needs a fully (rather than partially) defined inverse function for some purposes, including
for calculus. -/
def inverse {R : Type u_1} {M : Type u_2} {M₂ : Type u_3} [topological_space M] [topological_space M₂] [semiring R] [add_comm_monoid M₂] [semimodule R M₂] [add_comm_monoid M] [semimodule R M] : continuous_linear_map R M M₂ → continuous_linear_map R M₂ M :=
fun (f : continuous_linear_map R M M₂) =>
dite (∃ (e : continuous_linear_equiv R M M₂), ↑e = f)
(fun (h : ∃ (e : continuous_linear_equiv R M M₂), ↑e = f) => ↑(continuous_linear_equiv.symm (classical.some h)))
fun (h : ¬∃ (e : continuous_linear_equiv R M M₂), ↑e = f) => 0
/-- By definition, if `f` is invertible then `inverse f = f.symm`. -/
@[simp] theorem inverse_equiv {R : Type u_1} {M : Type u_2} {M₂ : Type u_3} [topological_space M] [topological_space M₂] [semiring R] [add_comm_monoid M₂] [semimodule R M₂] [add_comm_monoid M] [semimodule R M] (e : continuous_linear_equiv R M M₂) : inverse ↑e = ↑(continuous_linear_equiv.symm e) := sorry
/-- By definition, if `f` is not invertible then `inverse f = 0`. -/
@[simp] theorem inverse_non_equiv {R : Type u_1} {M : Type u_2} {M₂ : Type u_3} [topological_space M] [topological_space M₂] [semiring R] [add_comm_monoid M₂] [semimodule R M₂] [add_comm_monoid M] [semimodule R M] (f : continuous_linear_map R M M₂) (h : ¬∃ (e' : continuous_linear_equiv R M M₂), ↑e' = f) : inverse f = 0 :=
dif_neg h
@[simp] theorem ring_inverse_equiv {R : Type u_1} {M : Type u_2} [topological_space M] [ring R] [add_comm_group M] [topological_add_group M] [module R M] (e : continuous_linear_equiv R M M) : ring.inverse ↑e = inverse ↑e := sorry
/-- The function `continuous_linear_equiv.inverse` can be written in terms of `ring.inverse` for the
ring of self-maps of the domain. -/
theorem to_ring_inverse {R : Type u_1} {M : Type u_2} {M₂ : Type u_3} [topological_space M] [topological_space M₂] [ring R] [add_comm_group M] [topological_add_group M] [module R M] [add_comm_group M₂] [module R M₂] (e : continuous_linear_equiv R M M₂) (f : continuous_linear_map R M M₂) : inverse f = comp (ring.inverse (comp (↑(continuous_linear_equiv.symm e)) f)) ↑(continuous_linear_equiv.symm e) := sorry
theorem ring_inverse_eq_map_inverse {R : Type u_1} {M : Type u_2} [topological_space M] [ring R] [add_comm_group M] [topological_add_group M] [module R M] : ring.inverse = inverse := sorry
end continuous_linear_map
namespace submodule
/-- A submodule `p` is called *complemented* if there exists a continuous projection `M →ₗ[R] p`. -/
def closed_complemented {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] [module R M] (p : submodule R M) :=
∃ (f : continuous_linear_map R M ↥p), ∀ (x : ↥p), coe_fn f ↑x = x
theorem closed_complemented.has_closed_complement {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] [module R M] {p : submodule R M} [t1_space ↥p] (h : closed_complemented p) : ∃ (q : submodule R M), ∃ (hq : is_closed ↑q), is_compl p q := sorry
protected theorem closed_complemented.is_closed {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] [module R M] [topological_add_group M] [t1_space M] {p : submodule R M} (h : closed_complemented p) : is_closed ↑p := sorry
@[simp] theorem closed_complemented_bot {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] [module R M] : closed_complemented ⊥ := sorry
@[simp] theorem closed_complemented_top {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] [module R M] : closed_complemented ⊤ := sorry
end submodule
theorem continuous_linear_map.closed_complemented_ker_of_right_inverse {R : Type u_1} [ring R] {M : Type u_2} [topological_space M] [add_comm_group M] {M₂ : Type u_3} [topological_space M₂] [add_comm_group M₂] [module R M] [module R M₂] [topological_add_group M] (f₁ : continuous_linear_map R M M₂) (f₂ : continuous_linear_map R M₂ M) (h : function.right_inverse ⇑f₂ ⇑f₁) : submodule.closed_complemented (continuous_linear_map.ker f₁) :=
Exists.intro (continuous_linear_map.proj_ker_of_right_inverse f₁ f₂ h)
(continuous_linear_map.proj_ker_of_right_inverse_apply_idem f₁ f₂ h)
|
(* Title: HOL/Hoare/Hoare_Tac.thy
Author: Leonor Prensa Nieto & Tobias Nipkow
Author: Walter Guttmann (extension to total-correctness proofs)
*)
section \<open>Hoare logic VCG tactic\<close>
theory Hoare_Tac
imports MainRLT
begin
context
begin
qualified named_theorems BasicRule
qualified named_theorems SkipRule
qualified named_theorems AbortRule
qualified named_theorems SeqRule
qualified named_theorems CondRule
qualified named_theorems WhileRule
qualified named_theorems BasicRuleTC
qualified named_theorems SkipRuleTC
qualified named_theorems SeqRuleTC
qualified named_theorems CondRuleTC
qualified named_theorems WhileRuleTC
lemma Compl_Collect: "-(Collect b) = {x. \<not>(b x)}"
by blast
ML_file \<open>hoare_tac.ML\<close>
end
end
|
[STATEMENT]
lemma set_closure_prop_empty_all:
shows "set_closure_property S empty_interp"
and "set_closure_property S full_interp"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. set_closure_property S empty_interp &&& set_closure_property S full_interp
[PROOF STEP]
apply (metis empty_interp_def equals0D set_closure_propertyI)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. set_closure_property S full_interp
[PROOF STEP]
by (simp add: full_interp_def set_closure_propertyI) |
\documentclass{article}
\usepackage{color}
\usepackage{bigints}
\usepackage[italicdiff]{physics}
\color{white}
\definecolor{Red}{RGB}{124,10,2}
\begin{document}
\pagecolor{Red}
\title{Solution to Calculus with Calvin\textsc{\char13}s Problem}
\author{Jose Bedoya}
\maketitle
\section{Question}
{\LARGE
$$I=\bigintss_{0}^{1} \frac{\ln \left(x+1\right)\ln x}{x}\,dx$$
}
\section{Solution}
{\Large
Knowing,
$$\ln \left(x+1\right)=\sum_{n=1}^{\infty} \left(-1\right)^{n-1}\frac{x^n}{n}$$
\vspace{3mm}
We have
$$I=\sum_{n=1}^{\infty}\frac{\left(-1\right)^{n-1}}{n}\bigintsss_{0}^{1}x^{n-1}\ln x\,dx$$
\vspace{3mm}
Applying IBP, we get
$$I=\sum_{n=1}^{\infty}\frac{\left(-1\right)^{n-1}}{n}\left(\frac{x^n\ln x}{n}\Big|_0^1-\frac{1}{n}\bigintsss_{0}^{1}x^{n-1}\,dx\right)$$
$$=\sum_{n=1}^{\infty}\frac{\left(-1\right)^n}{n^3}$$
\vspace{4mm}
Let\textsc{\char13}s try to find a closed expression for this sum. We know:
$$\zeta\left(3\right)=\sum_{n=1}^{\infty}\frac{1}{n^3}$$
\vspace{3mm}
As you can see, our sum is equal to the even inverse cubes minus the odd ones. So, let\textsc{\char13}s find an expression for the odd ones
$$\sum_{n=1}^{\infty}\frac{1}{\left(2n+1\right)^3}=\sum_{n=1}^{\infty}\left(\frac{1}{n^3}-\frac{1}{\left(2n\right)^3}\right)$$
$$=\frac{7\zeta\left(3\right)}{8}$$
\vspace{3mm}
Therefore,
$$\sum_{n=1}^{\infty}\frac{\left(-1\right)^n}{n^3}=\sum_{n=1}^{\infty}\left(\frac{1}{\left(2n\right)^3}-\frac{1}{\left(2n+1\right)^3}\right)$$
\vspace{5mm}
Thus,
}
{\LARGE
$$I=\frac{-3\zeta\left(3\right)}{4}$$
}
\end{document} |
section \<open>Result\<close>
theory Result imports Soundness Completeness begin
theorem prover_soundness_completeness:
fixes A B :: \<open>fm list\<close>
defines \<open>t \<equiv> prover (A, B)\<close>
shows \<open>tfinite t \<and> wf t \<longleftrightarrow> (\<forall>(E :: _ \<Rightarrow> tm) F G. sc (E, F, G) (A, B))\<close>
using assms prover_soundness prover_completeness unfolding prover_def by fastforce
corollary
fixes p :: fm
defines \<open>t \<equiv> prover ([], [p])\<close>
shows \<open>tfinite t \<and> wf t \<longleftrightarrow> (\<forall>(E :: _ \<Rightarrow> tm) F G. \<lbrakk>E, F, G\<rbrakk> p)\<close>
using assms prover_soundness_completeness by simp
end
|
#ifdef USE_MKL
#include <mkl.h>
#else
#include <cblas.h>
#endif
// contains all calls to C-interface BLAS functions
// e.g. http://www.netlib.org/lapack/explore-html/d1/dff/cblas__example1_8c_source.html
// returns the dot product of x and y
// http://www.netlib.org/lapack/explore-html/d5/df6/ddot_8f_source.html
double specex_dot(int n, const double *x, const double *y){
return cblas_ddot(n, x, 1, y, 1);
}
// y += alpha*x
// http://www.netlib.org/lapack/explore-html/d9/dcd/daxpy_8f_source.html
void specex_axpy(int n, const double *alpha, const double *x, const double *y){
cblas_daxpy(n, *alpha, x, 1, y, 1);
}
// A += alpha*x*x**T, where A is a symmetric matrx (only lower half is filled)
// http://www.netlib.org/lapack/explore-html/d3/d60/dsyr_8f_source.html
void specex_syr(int n, const double *alpha, const double *x, const double *A){
cblas_dsyr(CblasColMajor, CblasLower, n, *alpha, x, 1, A, n);
}
// C = alpha*A**T + beta*C, where A is a symmetric matrx
// http://www.netlib.org/lapack/explore-html/dc/d05/dsyrk_8f_source.html
void specex_syrk(int n, int k, const double *alpha, const double *A, const double *beta,
const double *C){
cblas_dsyrk(CblasColMajor, CblasLower, CblasNoTrans, n, k, *alpha, A, n, *beta, C, n);
}
// y = alpha*A*x + beta*y
// http://www.netlib.org/lapack/explore-html/dc/da8/dgemv_8f_source.html
void specex_gemv(int m, int n, const double *alpha, const double *A, const double *x,
const double *beta, const double *y){
cblas_dgemv(CblasColMajor, CblasNoTrans, m, n, *alpha, A, m, x, 1, *beta, y, 1);
}
// C = alpha*A*B + beta*C
// http://www.netlib.org/lapack/explore-html/d7/d2b/dgemm_8f_source.html
void specex_gemm(int m, int n, int k, const double *alpha, const double *A, const double *B,
const double *beta, const double *C){
cblas_dgemm(CblasColMajor, CblasNoTrans, CblasNoTrans, m, n, k, *alpha, A, m, B, k, *beta, C, m);
}
|
# 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
#' FieldValuePatchItem Class
#'
#' @field projectId
#' @field fieldId
#' @field timePeriod
#' @field operations
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
FieldValuePatchItem <- R6::R6Class(
'FieldValuePatchItem',
public = list(
`projectId` = NULL,
`fieldId` = NULL,
`timePeriod` = NULL,
`operations` = NULL,
initialize = function(`projectId`, `fieldId`, `timePeriod`, `operations`){
if (!missing(`projectId`)) {
stopifnot(is.character(`projectId`), length(`projectId`) == 1)
self$`projectId` <- `projectId`
}
if (!missing(`fieldId`)) {
stopifnot(is.character(`fieldId`), length(`fieldId`) == 1)
self$`fieldId` <- `fieldId`
}
if (!missing(`timePeriod`)) {
stopifnot(R6::is.R6(`timePeriod`))
self$`timePeriod` <- `timePeriod`
}
if (!missing(`operations`)) {
stopifnot(R6::is.R6(`operations`))
self$`operations` <- `operations`
}
},
toJSON = function() {
FieldValuePatchItemObject <- list()
if (!is.null(self$`projectId`)) {
FieldValuePatchItemObject[['projectId']] <- self$`projectId`
}
if (!is.null(self$`fieldId`)) {
FieldValuePatchItemObject[['fieldId']] <- self$`fieldId`
}
if (!is.null(self$`timePeriod`)) {
FieldValuePatchItemObject[['timePeriod']] <- self$`timePeriod`$toJSON()
}
if (!is.null(self$`operations`)) {
FieldValuePatchItemObject[['operations']] <- self$`operations`$toJSON()
}
FieldValuePatchItemObject
},
fromJSON = function(FieldValuePatchItemJson) {
FieldValuePatchItemObject <- dlensFromJSON(FieldValuePatchItemJson)
if (!is.null(FieldValuePatchItemObject$`projectId`)) {
self$`projectId` <- FieldValuePatchItemObject$`projectId`
}
if (!is.null(FieldValuePatchItemObject$`fieldId`)) {
self$`fieldId` <- FieldValuePatchItemObject$`fieldId`
}
if (!is.null(FieldValuePatchItemObject$`timePeriod`)) {
timePeriodObject <- TimePeriod$new()
timePeriodObject$fromJSON(jsonlite::toJSON(FieldValuePatchItemObject$timePeriod, auto_unbox = TRUE))
self$`timePeriod` <- timePeriodObject
}
if (!is.null(FieldValuePatchItemObject$`operations`)) {
operationsObject <- Operations$new()
operationsObject$fromJSON(jsonlite::toJSON(FieldValuePatchItemObject$operations, auto_unbox = TRUE))
self$`operations` <- operationsObject
}
},
toJSONString = function() {
sprintf(
'{
"projectId": %s,
"fieldId": %s,
"timePeriod": %s,
"operations": %s
}',
self$`projectId`,
self$`fieldId`,
self$`timePeriod`$toJSON(),
self$`operations`$toJSON()
)
},
fromJSONString = function(FieldValuePatchItemJson) {
FieldValuePatchItemObject <- dlensFromJSON(FieldValuePatchItemJson)
self$`projectId` <- FieldValuePatchItemObject$`projectId`
self$`fieldId` <- FieldValuePatchItemObject$`fieldId`
TimePeriodObject <- TimePeriod$new()
self$`timePeriod` <- TimePeriodObject$fromJSON(jsonlite::toJSON(FieldValuePatchItemObject$timePeriod, auto_unbox = TRUE))
OperationsObject <- Operations$new()
self$`operations` <- OperationsObject$fromJSON(jsonlite::toJSON(FieldValuePatchItemObject$operations, auto_unbox = TRUE))
}
)
)
|
[STATEMENT]
lemma ord_order_ow_transfer[transfer_rule]:
assumes [transfer_rule]: "bi_unique A" "right_total A"
shows
"(
rel_set A ===> (A ===> A ===> (=)) ===> (A ===> A ===> (=)) ===>
(=)
) ord_order_ow ord_order_ow"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (rel_set A ===> (A ===> A ===> (=)) ===> (A ===> A ===> (=)) ===> (=)) ord_order_ow ord_order_ow
[PROOF STEP]
by (ow_locale_transfer locale_defs: ord_order_ow_def) |
Formal statement is: lemma Dynkin_system_Dynkin: assumes "M \<subseteq> Pow (\<Omega>)" shows "Dynkin_system \<Omega> (Dynkin \<Omega> M)" Informal statement is: If $M$ is a subset of the power set of $\Omega$, then the Dynkin system of $\Omega$ generated by $M$ is a Dynkin system. |
[STATEMENT]
lemma satPB_transE[simp]:
assumes \<xi>: "I.wtE \<xi>" shows "I.satPB \<xi> \<Phi>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. I.satPB \<xi> \<Phi>
[PROOF STEP]
unfolding I.satPB_def
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<forall>c\<in>\<Phi>. I.satC \<xi> c
[PROOF STEP]
proof safe
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
fix c
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
assume cin: "c \<in> \<Phi>"
[PROOF STATE]
proof (state)
this:
c \<in> \<Phi>
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
let ?thesis = "I.satC \<xi> c"
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
have mc: "\<And> \<sigma>. \<sigma> \<turnstile>2 c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<And>\<sigma>. \<sigma> \<turnstile>2 c
[PROOF STEP]
using mcalc2[OF cin]
[PROOF STATE]
proof (prove)
using this:
?\<sigma> \<turnstile>2 c
goal (1 subgoal):
1. \<And>\<sigma>. \<sigma> \<turnstile>2 c
[PROOF STEP]
.
[PROOF STATE]
proof (state)
this:
?\<sigma>7 \<turnstile>2 c
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
have c: "Ik.satC (transE \<xi>) c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. Ik.satC (transE \<xi>) c
[PROOF STEP]
using sat_\<Phi> wtE_transE[OF \<xi>] cin
[PROOF STATE]
proof (prove)
using this:
Ik.wtE ?\<xi> \<Longrightarrow> Ik.satPB ?\<xi> \<Phi>
Ik.wtE (transE \<xi>)
c \<in> \<Phi>
goal (1 subgoal):
1. Ik.satC (transE \<xi>) c
[PROOF STEP]
unfolding Ik.satPB_def
[PROOF STATE]
proof (prove)
using this:
Ik.wtE ?\<xi> \<Longrightarrow> \<forall>c\<in>\<Phi>. Ik.satC ?\<xi> c
Ik.wtE (transE \<xi>)
c \<in> \<Phi>
goal (1 subgoal):
1. Ik.satC (transE \<xi>) c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
Ik.satC (transE \<xi>) c
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
have wtC: "Ik.wtC c"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. wtC c
[PROOF STEP]
using wt_\<Phi> cin
[PROOF STATE]
proof (prove)
using this:
wtPB \<Phi>
c \<in> \<Phi>
goal (1 subgoal):
1. wtC c
[PROOF STEP]
unfolding wtPB_def
[PROOF STATE]
proof (prove)
using this:
Ball \<Phi> wtC
c \<in> \<Phi>
goal (1 subgoal):
1. wtC c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
wtC c
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
obtain l where lin: "l \<in> set c" and l: "Ik.satL (transE \<xi>) l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (\<And>l. \<lbrakk>l \<in> set c; Ik.satL (transE \<xi>) l\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
using c
[PROOF STATE]
proof (prove)
using this:
Ik.satC (transE \<xi>) c
goal (1 subgoal):
1. (\<And>l. \<lbrakk>l \<in> set c; Ik.satL (transE \<xi>) l\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
unfolding Ik.satC_iff_set
[PROOF STATE]
proof (prove)
using this:
Bex (set c) (Ik.satL (transE \<xi>))
goal (1 subgoal):
1. (\<And>l. \<lbrakk>l \<in> set c; Ik.satL (transE \<xi>) l\<rbrakk> \<Longrightarrow> thesis) \<Longrightarrow> thesis
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
l \<in> set c
Ik.satL (transE \<xi>) l
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
have wtL: "Ik.wtL l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. wtL l
[PROOF STEP]
using wtC
[PROOF STATE]
proof (prove)
using this:
wtC c
goal (1 subgoal):
1. wtL l
[PROOF STEP]
unfolding wtC_def
[PROOF STATE]
proof (prove)
using this:
list_all wtL c
goal (1 subgoal):
1. wtL l
[PROOF STEP]
by (metis (lifting) lin list_all_iff)
[PROOF STATE]
proof (state)
this:
wtL l
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
{
[PROOF STATE]
proof (state)
this:
wtL l
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
assume "\<not> ?thesis"
[PROOF STATE]
proof (state)
this:
\<not> I.satC \<xi> c
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
hence 0: "\<And> l'. l' \<in> set c \<Longrightarrow> \<not> I.satL \<xi> l'"
[PROOF STATE]
proof (prove)
using this:
\<not> I.satC \<xi> c
goal (1 subgoal):
1. \<And>l'. l' \<in> set c \<Longrightarrow> \<not> I.satL \<xi> l'
[PROOF STEP]
unfolding I.satC_iff_set
[PROOF STATE]
proof (prove)
using this:
\<not> Bex (set c) (I.satL \<xi>)
goal (1 subgoal):
1. \<And>l'. l' \<in> set c \<Longrightarrow> \<not> I.satL \<xi> l'
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
?l'7 \<in> set c \<Longrightarrow> \<not> I.satL \<xi> ?l'7
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
have "I.satL \<xi> l"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. I.satL \<xi> l
[PROOF STEP]
proof (rule satL_transE[OF wtL \<xi> _ l])
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>x. \<lbrakk>\<not> infTp (tpOfV x); x \<in> nv2L l\<rbrakk> \<Longrightarrow> \<exists>l'. wtL l' \<and> \<not> I.satL \<xi> l' \<and> isGuard x l'
[PROOF STEP]
fix x
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>x. \<lbrakk>\<not> infTp (tpOfV x); x \<in> nv2L l\<rbrakk> \<Longrightarrow> \<exists>l'. wtL l' \<and> \<not> I.satL \<xi> l' \<and> isGuard x l'
[PROOF STEP]
let ?\<sigma> = "tpOfV x"
[PROOF STATE]
proof (state)
goal (1 subgoal):
1. \<And>x. \<lbrakk>\<not> infTp (tpOfV x); x \<in> nv2L l\<rbrakk> \<Longrightarrow> \<exists>l'. wtL l' \<and> \<not> I.satL \<xi> l' \<and> isGuard x l'
[PROOF STEP]
assume \<sigma>: "\<not> infTp ?\<sigma>" and x: "x \<in> nv2L l"
[PROOF STATE]
proof (state)
this:
\<not> infTp (tpOfV x)
x \<in> nv2L l
goal (1 subgoal):
1. \<And>x. \<lbrakk>\<not> infTp (tpOfV x); x \<in> nv2L l\<rbrakk> \<Longrightarrow> \<exists>l'. wtL l' \<and> \<not> I.satL \<xi> l' \<and> isGuard x l'
[PROOF STEP]
hence g: "isGuard x (grdOf c l x)"
[PROOF STATE]
proof (prove)
using this:
\<not> infTp (tpOfV x)
x \<in> nv2L l
goal (1 subgoal):
1. isGuard x (grdOf c l x)
[PROOF STEP]
using mc[of ?\<sigma>] lin
[PROOF STATE]
proof (prove)
using this:
\<not> infTp (tpOfV x)
x \<in> nv2L l
tpOfV x \<turnstile>2 c
l \<in> set c
goal (1 subgoal):
1. isGuard x (grdOf c l x)
[PROOF STEP]
unfolding mcalc2_iff
[PROOF STATE]
proof (prove)
using this:
\<not> infTp (tpOfV x)
x \<in> nv2L l
infTp (tpOfV x) \<or> (\<forall>l xa. l \<in> set c \<and> xa \<in> nv2L l \<and> tpOfV xa = tpOfV x \<longrightarrow> isGuard xa (grdOf c l xa))
l \<in> set c
goal (1 subgoal):
1. isGuard x (grdOf c l x)
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
isGuard x (grdOf c l x)
goal (1 subgoal):
1. \<And>x. \<lbrakk>\<not> infTp (tpOfV x); x \<in> nv2L l\<rbrakk> \<Longrightarrow> \<exists>l'. wtL l' \<and> \<not> I.satL \<xi> l' \<and> isGuard x l'
[PROOF STEP]
show "\<exists> l'. Ik.wtL l' \<and> \<not> I.satL \<xi> l' \<and> isGuard x l'"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<exists>l'. wtL l' \<and> \<not> I.satL \<xi> l' \<and> isGuard x l'
[PROOF STEP]
apply(rule exI[of _ "grdOf c l x"])
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. wtL (grdOf c l x) \<and> \<not> I.satL \<xi> (grdOf c l x) \<and> isGuard x (grdOf c l x)
[PROOF STEP]
apply safe
[PROOF STATE]
proof (prove)
goal (3 subgoals):
1. wtL (grdOf c l x)
2. I.satL \<xi> (grdOf c l x) \<Longrightarrow> False
3. isGuard x (grdOf c l x)
[PROOF STEP]
using g \<sigma> cin lin wtL_grdOf x 0 grdOf x
[PROOF STATE]
proof (prove)
using this:
isGuard x (grdOf c l x)
\<not> infTp (tpOfV x)
c \<in> \<Phi>
l \<in> set c
\<lbrakk>?c \<in> \<Phi>; ?l \<in> set ?c; ?x \<in> nv2L ?l; \<not> infTp (tpOfV ?x)\<rbrakk> \<Longrightarrow> wtL (grdOf ?c ?l ?x)
x \<in> nv2L l
?l'7 \<in> set c \<Longrightarrow> \<not> I.satL \<xi> ?l'7
\<lbrakk>?c \<in> \<Phi>; ?l \<in> set ?c; ?x \<in> nv2L ?l; \<not> infTp (tpOfV ?x)\<rbrakk> \<Longrightarrow> grdOf ?c ?l ?x \<in> set ?c
x \<in> nv2L l
goal (3 subgoals):
1. wtL (grdOf c l x)
2. I.satL \<xi> (grdOf c l x) \<Longrightarrow> False
3. isGuard x (grdOf c l x)
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
\<exists>l'. wtL l' \<and> \<not> I.satL \<xi> l' \<and> isGuard x l'
goal:
No subgoals!
[PROOF STEP]
qed
[PROOF STATE]
proof (state)
this:
I.satL \<xi> l
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
hence False
[PROOF STATE]
proof (prove)
using this:
I.satL \<xi> l
goal (1 subgoal):
1. False
[PROOF STEP]
using 0 lin
[PROOF STATE]
proof (prove)
using this:
I.satL \<xi> l
?l'7 \<in> set c \<Longrightarrow> \<not> I.satL \<xi> ?l'7
l \<in> set c
goal (1 subgoal):
1. False
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
False
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
hence ?thesis
[PROOF STATE]
proof (prove)
using this:
False
goal (1 subgoal):
1. I.satC \<xi> c
[PROOF STEP]
by simp
[PROOF STATE]
proof (state)
this:
I.satC \<xi> c
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
}
[PROOF STATE]
proof (state)
this:
\<not> I.satC \<xi> c \<Longrightarrow> I.satC \<xi> c
goal (1 subgoal):
1. \<And>c. c \<in> \<Phi> \<Longrightarrow> I.satC \<xi> c
[PROOF STEP]
thus ?thesis
[PROOF STATE]
proof (prove)
using this:
\<not> I.satC \<xi> c \<Longrightarrow> I.satC \<xi> c
goal (1 subgoal):
1. I.satC \<xi> c
[PROOF STEP]
by auto
[PROOF STATE]
proof (state)
this:
I.satC \<xi> c
goal:
No subgoals!
[PROOF STEP]
qed |
import cv2
import matplotlib.pyplot as plt
import os
from keras.applications import DenseNet121
import numpy as np
from keras.models import *
from keras.layers import Dense, Dropout, Input
from keras.utils import np_utils
from keras.optimizers import *
import random
import tensorflow as tf
from keras.preprocessing.image import ImageDataGenerator
from keras.callbacks import ModelCheckpoint, ReduceLROnPlateau
random.seed(1)
traingen=ImageDataGenerator(rescale=1./255,
rotation_range=0.2,
width_shift_range=0.05,
height_shift_range=0.05,
shear_range=0.05,
zoom_range=0.05,
horizontal_flip=True,
fill_mode='nearest')
valgen=ImageDataGenerator(rescale=1./255,
rotation_range=0.2,
width_shift_range=0.05,
height_shift_range=0.05,
shear_range=0.05,
zoom_range=0.05,
horizontal_flip=True,
fill_mode='nearest')
seed =1
## Loading Dataset
train_set= traingen.flow_from_directory(directory='PALM/t1',target_size=(224,224),
batch_size=2,class_mode='categorical',seed=seed)
val_set = valgen.flow_from_directory(directory='PALM/v1',target_size=(224,224),
batch_size=2,class_mode='categorical',seed=seed)
## MODEL Definition
def def_model(pretrained_weights =None):
input=Input(shape=(224,224,3))
res=DenseNet121(input_tensor=input,include_top=False,pooling='max',weights='imagenet')
x=Dense(1024,activation='relu')(res.output)
x=Dropout(rate=0.4)(x)
out=Dense(2,activation='softmax')(x)
model=Model(inputs = res.input,outputs = out)
model.compile(optimizer=Adam(lr=1e-5),loss="categorical_crossentropy",metrics=['accuracy'])
if(pretrained_weights):
model.load_weights(pretrained_weights)
return model
## Training Model
model = def_model(pretrained_weights = 'PALM/DenseNet/Weights_DenseNet121/Densenet121.01-0.4548-0.8269.hdf5')#'PALM/DenseNet/Weights_DenseNet121/Densenet121.01-0.3693-0.9038.hdf5'
checkpoint =model_checkpoint = ModelCheckpoint('PALM/DenseNet/Weights_DenseNet121/Densenet121.{epoch:02d}-{val_loss:.4f}-{val_acc:.4f}.hdf5', monitor='val_loss',verbose=1, save_best_only=True)
reduce_lr = ReduceLROnPlateau(monitor='val_loss',mode='max',factor=0.3, patience=10, min_lr=1e-9, verbose=1)
callback_list= [checkpoint,reduce_lr]
history=model.fit_generator(generator = train_set,steps_per_epoch=171,epochs=50,callbacks=callback_list,
validation_data=val_set,validation_steps= 26,verbose=1)
|
<h2 id="Rough-volatility-with-Python">Rough volatility with Python<a class="anchor-link" href="#Rough-volatility-with-Python">¶</a></h2><p>
</p><p>Jim Gatheral</p>
<p>For Python Quants, New York, Friday May 6, 2016</p>
<h3></h3><h3></h3>
<h3 id="Acknowledgements">Acknowledgements<a class="anchor-link" href="#Acknowledgements">¶</a></h3><p>The code in this iPython notebook used to be in R. I am very grateful to Yves Hilpisch and Michael Schwed for translating my R-code to Python.</p>
<p>For slideshow functionality I use RISE by Damián Avila.</p>
$$
\newcommand{\beas}{\begin{eqnarray*}}
\newcommand{\eeas}{\end{eqnarray*}}
\newcommand{\bea}{\begin{eqnarray}}
\newcommand{\eea}{\end{eqnarray}}
\newcommand{\ben}{\begin{enumerate}}
\newcommand{\een}{\end{enumerate}}
\newcommand{\bi}{\begin{itemize}}
\newcommand{\ei}{\end{itemize}}
\newcommand{\beq}{\begin{equation}}
\newcommand{\eeq}{\end{equation}}
\newcommand{\bv}{\begin{verbatim}}
\newcommand{\ev}{\end{verbatim}}
\newcommand{\E}{\mathbb{E}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\mP}{\mathbb{P}}
\newcommand{\mQ}{\mathbb{Q}}
\newcommand{\sigl}{\sigma_L}
\newcommand{\BS}{\rm BS}
\newcommand{\vix}{\text{VIX}}
\newcommand{\p}{\partial}
\newcommand{\var}{{\rm var}}
\newcommand{\cov}{{\rm cov}}
\newcommand{\mt}{\mathbf{t}}
\newcommand{\mS}{\mathbf{S}}
\newcommand{\tC}{\widetilde{C}}
\newcommand{\hC}{\widehat{C}}
\newcommand{\cE}{\mathcal{E}}
\newcommand{\tH}{\widetilde{H}}
\newcommand{\cD}{\mathcal{D}}
\newcommand{\cM}{\mathcal{M}}
\newcommand{\cS}{\mathcal{S}}
\newcommand{\cR}{\mathcal{R}}
\newcommand{\cF}{\mathcal{F}}
\newcommand{\cV}{\mathcal{V}}
\newcommand{\cG}{\mathcal{G}}
\newcommand{\cv}{\mathcal{v}}
\newcommand{\cg}{\mathcal{g}}
\newcommand{\cL}{\mathcal{L}}
\newcommand{\cO}{\mathcal{O}}
\newcommand{\dt}{\Delta t}
\newcommand{\tr}{{\rm tr}}
\newcommand{\sgn}{\mathrm{sign}}
\newcommand{\ee}[1]{{\mathbb{E}\left[{#1}\right]}}
\newcommand{\eef}[1]{{\mathbb{E}\left[\left.{#1}\right|\cF_t\right]}}
\newcommand{\eefm}[2]{{\mathbb{E}^{#2}\left[\left.{#1}\right|\cF_t\right]}}
\newcommand{\angl}[1]{{\langle{#1}\rangle}}
$$
<h3 id="Outline-of-presentation">Outline of presentation<a class="anchor-link" href="#Outline-of-presentation">¶</a></h3><ul>
<li><p>The time series of historical volatility</p>
<ul>
<li>Scaling properties</li>
</ul>
</li>
<li><p>The RFSV model</p>
</li>
<li><p>Pricing under rough volatility</p>
</li>
<li><p>Forecasting realized variance</p>
</li>
<li><p>The time series of variance swaps</p>
</li>
<li><p>Relating historical and implied</p>
</li>
</ul>
<h3 id="The-time-series-of-realized-variance">The time series of realized variance<a class="anchor-link" href="#The-time-series-of-realized-variance">¶</a></h3><ul>
<li><p>Assuming an underlying variance process $v_s$, integrated variance $
\frac 1 \delta \,\int_t^{t+\delta}\,v_s\,ds$ may (in principle) be estimated arbitrarily accurately given enough price data.</p>
<ul>
<li>In practice, market microstructure noise makes estimation harder at very high frequency.</li>
<li>Sophisticated estimators of integrated variance have been developed to adjust for market microstructure noise. See Gatheral and Oomen <sup class="reference" id="cite_ref-GO"><a href="#cite_note-GO"><span>[</span>6<span>]</span></a></sup> (for example) for details of these.</li>
</ul>
</li>
</ul>
<ul>
<li><p>The Oxford-Man Institute of Quantitative Finance makes historical realized variance (RV) estimates freely available at <a href="http://realized.oxford-man.ox.ac.uk">http://realized.oxford-man.ox.ac.uk</a>. These estimates are updated daily.</p>
<ul>
<li>Each day, for 21 different indices, all trades and quotes are used to estimate realized (or integrated) variance over the trading day from open to close.</li>
</ul>
</li>
</ul>
<ul>
<li>Using daily RV estimates as proxies for instantaneous variance, we may investigate the time series properties of $v_t$ empirically.</li>
</ul>
<p>First load all necessary Python libraries.</p>
import warnings; warnings.simplefilter('ignore')
import datetime as dt
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.mlab as mlab
from matplotlib.mlab import stineman_interp
import pandas as pd
import pandas.io.data as web
import requests
import zipfile as zi
import StringIO as sio
from sklearn import datasets, linear_model
import scipy.special as scsp
import statsmodels.api as sm
import math
import seaborn as sns; sns.set()
%matplotlib inline
<p>Then update and save the latest Oxford-Man data.</p>
url = 'http://realized.oxford-man.ox.ac.uk/media/1366/'
url += 'oxfordmanrealizedvolatilityindices.zip'
data = requests.get(url, stream=True).content
z = zi.ZipFile(sio.StringIO(data))
z.extractall()
<p>There are many different estimates of realized variance, all of them very similar. We will use the realized kernel estimates denoted by ".rk".</p>
df = pd.read_csv('OxfordManRealizedVolatilityIndices.csv', index_col=0, header=2 )
rv1 = pd.DataFrame(index=df.index)
for col in df.columns:
if col[-3:] == '.rk':
rv1[col] = df[col]
rv1.index = [dt.datetime.strptime(str(date), "%Y%m%d") for date in rv1.index.values]
```julia
print("Hello world")
```
Hello world
<p>Let's plot SPX realized variance.</p>
```julia
spx = pd.DataFrame(rv1['SPX2.rk'])
spx.plot(color='red', grid=True, title='SPX realized variance',
figsize=(16, 9), ylim=(0,0.003));
```
<p>Figure 1: Oxford-Man KRV estimates of SPX realized variance from January 2000 to the current date.</p>
```julia
spx.head()
```
```julia
spx.tail()
```
<p>We can get SPX data from Yahoo using the <code>DataReader</code> function:</p>
```julia
SPX = web.DataReader(name = '^GSPC',data_source = 'yahoo', start='2000-01-01')
SPX = SPX['Adj Close']
SPX.plot(title='SPX',figsize=(14, 8));
```
<h3 id="The-smoothness-of-the-volatility-process">The smoothness of the volatility process<a class="anchor-link" href="#The-smoothness-of-the-volatility-process">¶</a></h3><p>For $q\geq 0$, we define the $q$th sample moment of differences of log-volatility at a given lag $\Delta$.($\angl{\cdot}$ denotes the sample average):</p>
$$
m(q,\Delta)=\angl{\left|\log \sigma_{t+\Delta} -\log \sigma_{t} \right|^q}
$$<p>For example</p>
$$
m(2,\Delta)=\angl{\left(\log \sigma_{t+\Delta} -\log \sigma_{t} \right)^2}
$$<p>is just the sample variance of differences in log-volatility at the lag $\Delta$.</p>
<h3 id="Scaling-of-$m(q,\Delta)$-with-lag-$\Delta$">Scaling of $m(q,\Delta)$ with lag $\Delta$<a class="anchor-link" href="#Scaling-of-$m(q,\Delta)$-with-lag-$\Delta$">¶</a></h3>
```julia
spx['sqrt']= np.sqrt(spx['SPX2.rk'])
spx['log_sqrt'] = np.log(spx['sqrt'])
def del_Raw(q, x):
return [np.mean(np.abs(spx['log_sqrt'] - spx['log_sqrt'].shift(lag)) ** q)
for lag in x]
```
```julia
plt.figure(figsize=(8, 8))
plt.xlabel('$log(\Delta)$')
plt.ylabel('$log\ m(q.\Delta)$')
plt.ylim=(-3, -.5)
zeta_q = list()
qVec = np.array([.5, 1, 1.5, 2, 3])
x = np.arange(1, 100)
for q in qVec:
plt.plot(np.log(x), np.log(del_Raw(q, x)), 'o')
model = np.polyfit(np.log(x), np.log(del_Raw(q, x)), 1)
plt.plot(np.log(x), np.log(x) * model[0] + model[1])
zeta_q.append(model[0])
print zeta_q
```
<p>Figure 2: $\log m(q,\Delta)$ as a function of $\log \Delta$, SPX.</p>
<h3 id="Monofractal-scaling-result">Monofractal scaling result<a class="anchor-link" href="#Monofractal-scaling-result">¶</a></h3><ul>
<li>From the above log-log plot, we see that for each $q$, $m(q,\Delta) \propto \Delta ^{\zeta_q}$.</li>
</ul>
<ul>
<li>How does $\zeta_q$ scale with $q$?</li>
</ul>
<h3 id="Scaling-of-$\zeta_q$-with-$q$">Scaling of $\zeta_q$ with $q$<a class="anchor-link" href="#Scaling-of-$\zeta_q$-with-$q$">¶</a></h3>
```julia
plt.figure(figsize=(8,8))
plt.xlabel('q')
plt.ylabel('$\zeta_{q}$')
plt.plot(qVec, zeta_q, 'or')
line = np.polyfit(qVec[:4], zeta_q[:4],1)
plt.plot(qVec, line[0] * qVec + line[1])
h_est= line[0]
print(h_est)
```
<p>Figure 3: Scaling of $\zeta_q$ with $q$.</p>
<p>We find the monofractal scaling relationship</p>
$$
\zeta_q = q\,H
$$<p>with $H \approx 0.13$.</p>
<ul>
<li>Note however that $H$ does vary over time, in a narrow range.</li>
</ul>
<ul>
<li>Note also that our estimate of $H$ is biased high because we proxied instantaneous variance $v_t$ with its average over each day $\frac 1T\,\int_0^T\,v_t\,dt$, where $T$ is one trading day.</li>
</ul>
<h3 id="Estimated-$H$-for-all-indices">Estimated $H$ for all indices<a class="anchor-link" href="#Estimated-$H$-for-all-indices">¶</a></h3><p>We now repeat this analysis for all 21 indices in the Oxford-Man dataset.</p>
```julia
def dlsig2(sic, x, pr=False):
if pr:
a= np.array([(sig-sig.shift(lag)).dropna() for lag in x])
a=a ** 2
print a.info()
return [np.mean((sig-sig.shift(lag)).dropna() ** 2) for lag in x]
```
```julia
h = list()
nu = list()
for col in rv1.columns:
sig = rv1[col]
sig = np.log(np.sqrt(sig))
sig = sig.dropna()
model = np.polyfit(np.log(x), np.log(dlsig2(sig, x)), 1)
nu.append(np.sqrt(np.exp(model[1])))
h.append(model[0]/2.)
OxfordH = pd.DataFrame({'names':rv1.columns, 'h_est': h, 'nu_est': nu})
```
```julia
OxfordH
```
<h3 id="Distributions-of-$(\log-\sigma_{t+\Delta}-\log-\sigma_t)$-for-various-lags-$\Delta$">Distributions of $(\log \sigma_{t+\Delta}-\log \sigma_t)$ for various lags $\Delta$<a class="anchor-link" href="#Distributions-of-$(\log-\sigma_{t+\Delta}-\log-\sigma_t)$-for-various-lags-$\Delta$">¶</a></h3><p>Having established these beautiful scaling results for the moments, how do the histograms look?</p>
```julia
def plotScaling(j, scaleFactor):
col_name = rv1.columns[j]
v = rv1[col_name]
x = np.arange(1,101)
def xDel(x, lag):
return x-x.shift(lag)
def sdl(lag):
return (xDel(np.log(v), lag)).std()
sd1 = (xDel(np.log(v), 1)).std()
h = OxfordH['h_est'][j]
f, ax = plt.subplots(2,2,sharex=False, sharey=False, figsize=(10, 10))
for i_0 in range(0, 2):
for i_1 in range(0, 2):
la = scaleFactor ** (i_1*1+i_0*2)
hist_val = xDel(np.log(v), la).dropna()
std = hist_val.std()
mean = hist_val.mean()
ax[i_0][i_1].set_title('Lag = %s Days' %la)
n, bins, patches = ax[i_0][i_1].hist(hist_val.values, bins=100,
normed=1, facecolor='green',alpha=0.2)
ax[i_0][i_1].plot(bins, mlab.normpdf(bins,mean,std), "r")
ax[i_0][i_1].plot(bins, mlab.normpdf(bins,0,sd1 * la ** h), "b--")
hist_val.plot(kind='density', ax=ax[i_0][i_1])
```
```julia
plotScaling(1,5)
```
<p>Figure 4: Histograms of $(\log \sigma_{t+\Delta}-\log \sigma_t)$ for various lags $\Delta$; normal fit in red; $\Delta=1$ normal fit scaled by $\Delta^{0.14}$ in blue.</p>
<h3 id="Universality?">Universality?<a class="anchor-link" href="#Universality?">¶</a></h3><ul>
<li><span>[Gatheral, Jaisson and Rosenbaum]<sup class="reference" id="cite_ref-GJR"><a href="#cite_note-GJR"><span>[</span>5<span>]</span></a></sup> compute daily realized variance estimates over one hour windows for DAX and Bund futures contracts, finding similar scaling relationships.</a></sup></span></li>
</ul>
<ul>
<li><p>We have also checked that Gold and Crude Oil futures scale similarly.</p>
<ul>
<li>Although the increments $(\log \sigma_{t+\Delta}-\log \sigma_t)$ seem to be fatter tailed than Gaussian. </li>
</ul>
</li>
</ul>
<h3 id="A-natural-model-of-realized-volatility">A natural model of realized volatility<a class="anchor-link" href="#A-natural-model-of-realized-volatility">¶</a></h3><ul>
<li><p>As noted originally by <span>[Andersen et al.]<sup class="reference" id="cite_ref-ABDE"><a href="#cite_note-ABDE"><span>[</span>1<span>]</span></a></sup>, distributions of differences in the log of realized volatility are close to Gaussian.</a></sup></span></p>
<ul>
<li>This motivates us to model $\sigma_t$ as a lognormal random variable.</li>
</ul>
</li>
</ul>
<ul>
<li>Moreover, the scaling property of variance of RV differences suggests the model:</li>
</ul>
<p><a name="eq:dataDriven"></a>(1)
$$
\log \sigma_{t+\Delta} - \log \sigma_t =\nu\,\left( W^H_{t+\Delta}-W^H_t\right)
$$</p>
<p>where $W^H$ is fractional Brownian motion.</p>
<ul>
<li>In <span>[Gatheral, Jaisson and Rosenbaum]<sup class="reference" id="cite_ref-GJR"><a href="#cite_note-GJR"><span>[</span>5<span>]</span></a></sup>, we refer to a stationary version of </a><a href="#eq:dataDriven">(1)</a> as the RFSV (for Rough Fractional Stochastic Volatility) model.</sup></span></li>
</ul>
<h3 id="Fractional-Brownian-motion-(fBm)">Fractional Brownian motion (fBm)<a class="anchor-link" href="#Fractional-Brownian-motion-(fBm)">¶</a></h3><ul>
<li><p><em>Fractional Brownian motion</em> (fBm) $\{W^H_t; t \in \mathbb{R}\}$ is the unique Gaussian process with mean zero and autocovariance function
$$
\ee{ W^H_t\,W^H_s } = \frac12\,\left\{ |t|^{2\,H}+|s|^{2\,H}-|t-s|^{2\,H} \right\}
$$
where $H \in (0,1)$ is called the <em>Hurst index</em> or parameter.</p>
<ul>
<li><p>In particular, when $H=1/2$, fBm is just Brownian motion.</p>
</li>
<li><p>If $H>1/2$, increments are positively correlated.% so the process is trending.</p>
</li>
<li>If $H<1/2$, increments are negatively correlated.% so the process is reverting.</li>
</ul>
</li>
</ul>
<h3 id="Representations-of-fBm">Representations of fBm<a class="anchor-link" href="#Representations-of-fBm">¶</a></h3><p>There are infinitely many possible representations of fBm in terms of Brownian motion. For example, with $\gamma = \frac 12 - H$,</p>
<blockquote><div style="background-color:#add8e6; color:#FFFFFF; font-style: normal; "><h4>
Mandelbrot-Van Ness</h4>
</div>
<div style="background-color:#E8E8E8; color:#000000; font-style: normal; ">
<br/>
$$
W^H_t ={C_H}\,\left\{\int_{-\infty}^t \,\frac{dW_s}{(t-s)^\gamma} - \int_{-\infty}^0 \,\frac{dW_s}{(-s)^\gamma}\right\}.
$$
<br/>
</div>
</blockquote>
<p>The choice</p>
$$
C_H = \sqrt{ \frac{2\,H\,\Gamma(3/2-H)}{\Gamma(H+1/2)\,\Gamma(2-2\,H)}}
$$<p>ensures that</p>
$$
\ee{W^H_t\,W^H_s }= \frac{1}{2}\,\left\{t^{2 H} + s^{2 H} - |t-s|^{2 H}\right\}.
$$
<h3 id="Does-simulated-RSFV-data-look-real?">Does simulated RSFV data look real?<a class="anchor-link" href="#Does-simulated-RSFV-data-look-real?">¶</a></h3>
<h3></h3>
<p>Figure 8: Volatility of SPX (above) and of the RFSV model (below).</p>
<h3 id="Remarks-on-the-comparison">Remarks on the comparison<a class="anchor-link" href="#Remarks-on-the-comparison">¶</a></h3><ul>
<li><p>The simulated and actual graphs look very alike.</p>
</li>
<li><p>Persistent periods of high volatility alternate with low volatility periods.</p>
</li>
<li><p>$H \sim 0.1$ generates very rough looking sample paths (compared with $H=1/2$ for Brownian motion).</p>
</li>
<li><p>Hence <em>rough volatility</em>.</p>
</li>
</ul>
<ul>
<li><p>On closer inspection, we observe fractal-type behavior.</p>
</li>
<li><p>The graph of volatility over a small time period looks like the same graph over a much longer time period.</p>
</li>
<li><p>This feature of volatility has been investigated both empirically and theoretically in, for example, <span>[Bacry and Muzy]<sup class="reference" id="cite_ref-BacryMuzy"><a href="#cite_note-BacryMuzy"><span>[</span>3<span>]</span></a></sup>
.</a></sup></span></p>
</li>
<li><p>In particular, their Multifractal Random Walk (MRW) is related to a limiting case of the RSFV model as $H \to 0$.</p>
</li>
</ul>
<h3 id="Pricing-under-rough-volatility">Pricing under rough volatility<a class="anchor-link" href="#Pricing-under-rough-volatility">¶</a></h3><p>The foregoing behavior suggest the following model (see <span>[Bayer et al.]<sup class="reference" id="cite_ref-BayerFriz"><a href="#cite_note-BayerFriz"><span>[</span>2<span>]</span></a></sup> for volatility under the real (or historical or physical) measure $\mP$:</a></sup></span></p>
$$
\log \sigma_t =\nu\,W^H_t.
$$<p>Let $\gamma=\frac{1}{2}-H$. We choose the Mandelbrot-Van Ness representation of fractional Brownian motion $W^H$ as follows:</p>
$$
W^H_t ={C_H}\,\left\{\int_{-\infty}^t \,\frac{dW^{\mP}_s}{(t-s)^\gamma} - \int_{-\infty}^0 \,\frac{dW^{\mP}_s}{(-s)^\gamma}\right\}.
$$
<p>Then</p>
$$
\begin{eqnarray}
&&\log v_u - \log v_t \nonumber\\
&=&\nu\,C_H\,\left\{ \int_t^u\,\frac{1}{(u-s)^\gamma}\,d{W}^{\mP}_s +\int_{-\infty}^t\,\left[ \frac{1}{(u-s)^\gamma}-\frac{1}{(t-s)^\gamma} \right]\,d{W}^{\mP}_s\right\}\nonumber\\
&=:& 2\,\nu\,C_H\,\left[M_t(u)+ Z_t(u)\right].
\end{eqnarray}
$$<ul>
<li><p>Note that $\eefm{M_t(u)}{\mP}=0$ and $Z_t(u)$ is $\cF_t$-measurable.</p>
<ul>
<li>To price options, it would seem that we would need to know $\cF_t$, the entire history of the Brownian motion $W_s$ for $s<t>
</t></li></ul>
</li>
</ul>
<h3 id="Pricing-under-$\mP$">Pricing under $\mP$<a class="anchor-link" href="#Pricing-under-$\mP$">¶</a></h3><p>Let</p>
$$
\tilde W^{\mP}_t(u) := \sqrt{2\,H}\,\int_t^u\,\frac{dW^{\mP}_s}{(u-s)^\gamma}
$$<p>With
$\eta := 2\,\nu\,C_H/\sqrt{2\,H}$ we have $2\,\nu\,C_H\, M_t(u)
= \eta\, \tilde W^{\mP}_t(u)$ so denoting the stochastic exponential by $\cE(\cdot)$, we may write</p>
$$
\begin{eqnarray}
v_u &=& v_t \exp\left\{ \eta \tilde W^{\mP}_t(u) +
2\,\nu\,C_H\,
Z_t(u) \right\}\nonumber\\
&=& \eefm{v_u}{\mP}\,\cE \left(\eta\,\tilde W^{\mP}_t(u) \right).
%\label{eq:rBergomiP}
\end{eqnarray}
$$<p></p>
<ul>
<li>The conditional distribution of $v_u$ depends on $\cF_t$ only through the variance forecasts $\eefm{v_u}{\mP}$, </li>
</ul>
<ul>
<li>To price options, one does not need to know $\cF_t$, the entire history of the Brownian motion $W_s^{\mP}$ for $s<t>
</t></li></ul>
<h3 id="Pricing-under-$\mQ$">Pricing under $\mQ$<a class="anchor-link" href="#Pricing-under-$\mQ$">¶</a></h3><p>Our model under $\mP$ reads:</p>
<p><a name="eq:Pmodel"></a>(2)
$$
v_u =\eefm{v_u}{\mP}\,\cE\left(\eta\,\tilde W^{\mP}_t(u) \right).
%\label{eq:Pmodel}
$$</p>
<p>Consider some general change of measure</p>
$$
dW^{\mP}_s = dW^{\mQ}_s + \lambda_s\,ds,
%\label{eq:dQdP}
$$<p>where $\{ \lambda_s: s > t \}$ has a natural interpretation as the price of volatility risk.</p>
<p>We may then rewrite <a href="#eq:Pmodel">(2)</a> as</p>
$$
v_u
= \eefm{v_u}{\mP}\,\cE\left(\eta\,\tilde W^{\mQ}_t(u) \right)
\exp \left\{ \eta\,\sqrt{2\,H}\, \int_t^u\,\frac{\lambda_s}{(u-s)^\gamma}\,ds\right\}.
%\label{eq:explicitBergomiQ1}
$$<ul>
<li><p>Although the conditional distribution of $v_u$ under $\mP$ is lognormal, it will not be lognormal in general under $\mQ$.</p>
<ul>
<li>The upward sloping smile in VIX options means $\lambda_s$ cannot be deterministic in this picture.</li>
</ul>
</li>
</ul>
<h3 id="The-rough-Bergomi-(rBergomi)-model">The rough Bergomi (rBergomi) model<a class="anchor-link" href="#The-rough-Bergomi-(rBergomi)-model">¶</a></h3><p>Let's nevertheless consider the simplest change of measure</p>
$$
d{W}^{\mP}_s = d{W}^{\mQ}_s + \lambda(s)\,ds,
$$<p>where $\lambda(s)$ is a deterministic function of $s$. Then from <a href="#eq:Pmodel">(2)</a>, we would have</p>
$$
\begin{eqnarray}
v_u
&=& \eefm{v_u}{\mP}\,\cE\left(\eta\,\tilde W^{\mQ}_t(u) \right)
\exp \left\{ \eta\,\sqrt{2\,H}\, \int_t^u\,\frac{1}{(u-s)^\gamma}\,\lambda(s)\,ds\right\}\nonumber\\
&=& \xi_t(u) \,\cE\left(\eta\,\tilde W^{\mQ}_t(u) \right)%\label{eq:explicitBergomiQ}
\end{eqnarray}
$$<p>where the forward variances $\xi_t(u) = \eefm{v_u}{\mQ}$ are (at least in principle) tradable and observed in the market.</p>
<ul>
<li><p>$\xi_t(u)$ is the product of two terms:</p>
<ul>
<li>$ \eefm{v_u}{\mP}$ which depends on the historical path $\{W_s, s<t brownian="" motion="" of="" the="">
<li>a term which depends on the price of risk $\lambda(s)$.</li>
</t></li></ul>
</li>
</ul>
<h3 id="Features-of-the-rough-Bergomi-model">Features of the rough Bergomi model<a class="anchor-link" href="#Features-of-the-rough-Bergomi-model">¶</a></h3><ul>
<li>The rBergomi model is a non-Markovian generalization of the Bergomi model:
$$
\eef{v_u}\neq \E[v_u|v_t].
$$<ul>
<li>The rBergomi model is Markovian in the (infinite-dimensional) state vector $\eefm{v_u}{\mQ}=\xi_t(u)$.</li>
</ul>
</li>
</ul>
<ul>
<li>We have achieved our aim from Session 1 of replacing the exponential kernels in the Bergomi model with a power-law kernel. </li>
</ul>
<ul>
<li>We may therefore expect that the rBergomi model will generate a realistic term structure of ATM volatility skew.</li>
</ul>
<h3 id="Re-interpretation-of-the-conventional-Bergomi-model">Re-interpretation of the conventional Bergomi model<a class="anchor-link" href="#Re-interpretation-of-the-conventional-Bergomi-model">¶</a></h3><ul>
<li><p>A conventional $n$-factor Bergomi model is not self-consistent for an arbitrary choice of the initial forward variance curve $\xi_t(u)$.</p>
<ul>
<li>$\xi_t(u)=\eef{v_u}$ should be consistent with the assumed dynamics.</li>
</ul>
</li>
</ul>
<ul>
<li><p>Viewed from the perspective of the fractional Bergomi model however:</p>
<ul>
<li>The initial curve $\xi_t(u)$ reflects the history $\{W_s; s<t brownian="" driving="" motion="" of="" the="" time="" to="" up="">
<li>The exponential kernels in the exponent of the conventional Bergomi model approximate more realistic power-law kernels.</li>
</t></li></ul>
</li>
</ul>
<ul>
<li>The conventional two-factor Bergomi model is then justified in practice as a tractable Markovian engineering approximation to a more realistic fractional Bergomi model.</li>
</ul>
<h3 id="The-stock-price-process">The stock price process<a class="anchor-link" href="#The-stock-price-process">¶</a></h3><ul>
<li>The observed anticorrelation between price moves and volatility moves may be modeled naturally by anticorrelating the Brownian motion $W$ that drives the volatility process with the Brownian motion driving the price process. </li>
</ul>
<ul>
<li>Thus
$$
\frac{dS_t}{S_t}=\sqrt{v_t}\,dZ_t
$$
with
$$
dZ_t = \rho\,dW_t + \sqrt{1-\rho^2}\,dW^\perp_t
$$
where $\rho$ is the correlation between volatility moves and price moves.</li>
</ul>
<h3 id="Simulation-of-the--rBergomi-model">Simulation of the rBergomi model<a class="anchor-link" href="#Simulation-of-the--rBergomi-model">¶</a></h3><p>We simulate the rBergomi model as follows:</p>
<ul>
<li>Construct the joint covariance matrix for the Volterra process $\tilde
W$ and the Brownian motion $Z$ and compute its Cholesky decomposition.</li>
</ul>
<ul>
<li>For each time, generate iid normal random vectors {and
multiply them by the lower-triangular matrix obtained by the Cholesky
decomposition} to get a $m \times 2\,n$ matrix of paths of $\tilde W$ and $Z$ with the correct joint marginals.</li>
</ul>
<ul>
<li>With these paths held in memory, we may evaluate the expectation under $\mQ$ of any payoff of interest.</li>
</ul>
<ul>
<li><p>This procedure is very slow!</p>
<ul>
<li>Speeding up the simulation is work in progress.</li>
</ul>
</li>
</ul>
<h3 id="Guessing-rBergomi-model-parameters">Guessing rBergomi model parameters<a class="anchor-link" href="#Guessing-rBergomi-model-parameters">¶</a></h3><ul>
<li>The rBergomi model has only three parameters: $H$, $\eta$ and $\rho$.</li>
</ul>
<ul>
<li>If we had a fast simulation, we could just iterate on these parameters to find the best fit to observed option prices. But we don't.</li>
</ul>
<ul>
<li><p>However, the model parameters $H$, $\eta$ and $\rho$ have very direct interpretations:</p>
<ul>
<li><p>$H$ controls the decay of ATM skew $\psi(\tau)$ for very short expirations.</p>
</li>
<li><p>The product $\rho\,\eta$ sets the level of the ATM skew for longer expirations.</p>
<ul>
<li>Keeping $\rho\,\eta$ constant but decreasing $\rho$ (so as to make it more negative) pushes the minimum of each smile towards higher strikes. </li>
</ul>
</li>
</ul>
</li>
</ul>
<ul>
<li>So we can guess parameters in practice.</li>
</ul>
<ul>
<li>As we will see, even without proper calibration (<em>i.e.</em> just guessing parameters), rBergomi model fits to the volatility surface are amazingly good.</li>
</ul>
<h3 id="SPX-smiles-in-the-rBergomi-model">SPX smiles in the rBergomi model<a class="anchor-link" href="#SPX-smiles-in-the-rBergomi-model">¶</a></h3><ul>
<li><p>In Figures 9 and 10, we show how well a rBergomi model simulation with guessed parameters fits the SPX option market as of February 4, 2010, a day when the ATM volatility term structure happened to be pretty flat.</p>
<ul>
<li>rBergomi parameters were: $H=0.07$, $\eta=1.9$, $\rho=-0.9$.</li>
</ul>
</li>
</ul>
<ul>
<li>Only three parameters to get a very good fit to the whole SPX volatility surface!</li>
</ul>
<h3 id="rBergomi-fits-to-SPX-smiles-as-of-04-Feb-2010">rBergomi fits to SPX smiles as of 04-Feb-2010<a class="anchor-link" href="#rBergomi-fits-to-SPX-smiles-as-of-04-Feb-2010">¶</a></h3><h3></h3>
<p>Figure 9: Red and blue points represent bid and offer SPX implied volatilities; orange smiles are from the rBergomi simulation.</p>
<h3 id="Shortest-dated-smile-as-of-February-4,-2010">Shortest dated smile as of February 4, 2010<a class="anchor-link" href="#Shortest-dated-smile-as-of-February-4,-2010">¶</a></h3><h3></h3>
<p>Figure 10: Red and blue points represent bid and offer SPX implied volatilities; orange smile is from the rBergomi simulation.</p>
<h3 id="ATM-volatilities-and-skews">ATM volatilities and skews<a class="anchor-link" href="#ATM-volatilities-and-skews">¶</a></h3><p>In Figures 11 and 12, we see just how well the rBergomi model can match empirical skews and vols. Recall also that the parameters we used are just guesses!</p>
<h3 id="Term-structure-of-ATM-skew-as-of-February-4,-2010">Term structure of ATM skew as of February 4, 2010<a class="anchor-link" href="#Term-structure-of-ATM-skew-as-of-February-4,-2010">¶</a></h3><h3></h3>
<p>Figure 11: Blue points are empirical skews; the red line is from the rBergomi simulation.</p>
<h3 id="Term-structure-of-ATM-vol-as-of-February-4,-2010">Term structure of ATM vol as of February 4, 2010<a class="anchor-link" href="#Term-structure-of-ATM-vol-as-of-February-4,-2010">¶</a></h3><h3></h3>
<p>Figure 12: Blue points are empirical ATM volatilities; the red line is from the rBergomi simulation.</p>
<h3 id="Another-date">Another date<a class="anchor-link" href="#Another-date">¶</a></h3><ul>
<li>Now we take a look at another date: August 14, 2013, two days before the last expiration date in our dataset.</li>
</ul>
<ul>
<li>Options set at the open of August 16, 2013 so only one trading day left.</li>
</ul>
<ul>
<li>Note in particular that the extreme short-dated smile is well reproduced by the rBergomi model.</li>
</ul>
<ul>
<li>There is no need to add jumps!</li>
</ul>
<h3 id="SPX-smiles-as-of-August-14,-2013">SPX smiles as of August 14, 2013<a class="anchor-link" href="#SPX-smiles-as-of-August-14,-2013">¶</a></h3><h3></h3>
<p>Figure 13: Red and blue points represent bid and offer SPX implied volatilities; orange smiles are from the rBergomi simulation.</p>
<h3 id="The-forecast-formula">The forecast formula<a class="anchor-link" href="#The-forecast-formula">¶</a></h3><ul>
<li>In the RFSV model <a href="#eq:dataDriven">(1)</a>, $\log \sigma_t \approx \nu\,W^H_t+C$ for some constant $C$.</li>
</ul>
<ul>
<li><span>[Nuzman and Poor]<sup class="reference" id="cite_ref-NuzmanPoor"><a href="#cite_note-NuzmanPoor"><span>[</span>7<span>]</span></a></sup> show that $W^H_{t+\Delta}$ is conditionally Gaussian with conditional expectation</a></sup></span></li>
</ul>
$$\E[W^H_{t+\Delta}|\cF_t]=\frac{\cos(H\pi)}{\pi} \Delta^{H+1/2} \int_{-\infty}^t \frac{W^H_s}{(t-s+\Delta)(t-s)^{H+1/2}} ds
$$<p></p>
<p>and conditional variance</p>
$$
\text{Var}[W^H_{t+\Delta}|\cF_t]=c\,\Delta^{2H}.
$$<p>where $$
c = \frac{\Gamma(3/2-H)}{\Gamma(H+1/2)\,\Gamma(2-2H)}.
$$</p>
<h3 id="The-forecast-formula">The forecast formula<a class="anchor-link" href="#The-forecast-formula">¶</a></h3><p>Thus, we obtain</p>
<blockquote><div style="background-color:#add8e6; color:#FFFFFF; font-style: normal; "><h4>
Variance forecast formula</h4>
</div>
<div style="background-color:#E8E8E8; color:#000000; font-style: normal; ">
<br/>
<a name="eq:vForecast"></a>(3)
$$
\eefm{v_{t+\Delta}}{\mP}=\exp\left\{\eefm{\log(v_{t+\Delta})}{\mP}+2\, c\,\nu^2\Delta^{2\,H}\right\}
%\label{eq:vForecast}
$$
<br/>
</div>
</blockquote><p>where</p>
$$
\beas
&&\eefm{\log v_{t+\Delta}}{\mP}\\
&&= \frac{\cos(H\pi)}{\pi} \Delta^{H+1/2} \int_{-\infty}^t \frac{\log v_s}{(t-s+\Delta)(t-s)^{H+1/2}} ds.
\eeas
$$
<h3 id="Implement-variance-forecast-in-Python">Implement variance forecast in Python<a class="anchor-link" href="#Implement-variance-forecast-in-Python">¶</a></h3>
```julia
def c_tilde(h):
return scsp.gamma(3. / 2. - h) / scsp.gamma(h + 1. / 2.) * scsp.gamma(2. - 2. * h)
def forecast_XTS(rvdata, h, date, nLags, delta, nu):
i = np.arange(nLags)
cf = 1./((i + 1. / 2.) ** (h + 1. / 2.) * (i + 1. / 2. + delta))
ldata = rvdata.truncate(after=date)
l = len(ldata)
ldata = np.log(ldata.iloc[l - nLags:])
ldata['cf'] = np.fliplr([cf])[0]
# print ldata
ldata = ldata.dropna()
fcst = (ldata.iloc[:, 0] * ldata['cf']).sum() / sum(ldata['cf'])
return math.exp(fcst + 2 * nu ** 2 * c_tilde(h) * delta ** (2 * h))
```
<h3 id="SPX-actual-vs-forecast-variance">SPX actual vs forecast variance<a class="anchor-link" href="#SPX-actual-vs-forecast-variance">¶</a></h3>
```julia
rvdata = pd.DataFrame(rv1['SPX2.rk'])
nu = OxfordH['nu_est'][0] # Vol of vol estimate for SPX
h = OxfordH['h_est'][0]
n = len(rvdata)
delta = 1
nLags = 500
dates = rvdata.iloc[nLags:n-delta].index
rv_predict = [forecast_XTS(rvdata, h=h, date=d, nLags=nLags,
delta=delta, nu=nu) for d in dates]
rv_actual = rvdata.iloc[nLags+delta:n].values
```
<h3 id="Scatter-plot-of-delta-days-ahead-predictions">Scatter plot of delta days ahead predictions<a class="anchor-link" href="#Scatter-plot-of-delta-days-ahead-predictions">¶</a></h3>
```julia
plt.figure(figsize=(8, 8))
plt.plot(rv_predict, rv_actual, 'bo');
```
<p>Figure 14: Actual vols vs predicted vols.</p>
<h3 id="Superimpose-actual-and-predicted-vols">Superimpose actual and predicted vols<a class="anchor-link" href="#Superimpose-actual-and-predicted-vols">¶</a></h3>
```julia
plt.figure(figsize=(11, 6))
vol_actual = np.sqrt(np.multiply(rv_actual,252))
vol_predict = np.sqrt(np.multiply(rv_predict,252))
plt.plot(vol_actual, "b")
plt.plot(vol_predict, "r");
```
<p>Figure 15: Actual volatilities in blue; predicted vols in red.</p>
<h3 id="Forecasting-the-variance-swap-curve">Forecasting the variance swap curve<a class="anchor-link" href="#Forecasting-the-variance-swap-curve">¶</a></h3><p>Finally, we forecast the whole variance swap curve using the variance forecasting formula <a href="#eq:vForecast">(3)</a>.</p>
```julia
def xi(date, tt, nu,h, tscale): # dt=(u-t) is in units of years
rvdata = pd.DataFrame(rv1['SPX2.rk'])
return [ forecast_XTS(rvdata,h=h,date=date,nLags=500,delta=dt*tscale,nu=nu) for dt in tt]
nu = OxfordH["nu_est"][0]
h = OxfordH["h_est"][0]
def varSwapCurve(date, bigT, nSteps, nu, h, tscale, onFactor):
# Make vector of fwd variances
tt = [ float(i) * (bigT) / nSteps for i in range(nSteps+1)]
delta_t = tt[1]
xicurve = xi(date, tt, nu, h, tscale)
xicurve_mid = (np.array(xicurve[0:nSteps]) + np.array(xicurve[1:nSteps+1])) / 2
xicurve_int = np.cumsum(xicurve_mid) * delta_t
varcurve1 = np.divide(xicurve_int, np.array(tt[1:]))
varcurve = np.array([xicurve[0],]+list(varcurve1))
varcurve = varcurve * onFactor * tscale # onFactor is to compensate for overnight moves
res = pd.DataFrame({"texp":np.array(tt), "vsQuote":np.sqrt(varcurve)})
return(res)
```
```julia
def varSwapForecast(date,tau,nu,h,tscale,onFactor):
vsc = varSwapCurve(date, bigT=2.5, nSteps=100, nu=nu, h=h,
tscale=tscale, onFactor=onFactor) # Creates the whole curve
x = vsc['texp']
y = vsc['vsQuote']
res = stineman_interp(tau,x,y,None)
return(res)
# Test the function
tau = (.25,.5,1,2)
date = dt.datetime(2008,9,8)
varSwapForecast(date,tau,nu=nu,h=h,tscale=252,onFactor=1)
```
<h3 id="'Constructing-a-time-series-of-variance-swap-curves">'Constructing a time series of variance swap curves<a class="anchor-link" href="#'Constructing-a-time-series-of-variance-swap-curves">¶</a></h3><p>For each of 2,658 days from Jan 27, 2003 to August 31, 2013:</p>
<ul>
<li>We compute proxy variance swaps from closing prices of SPX options sourced from OptionMetrics (www.optionmetrics.com) via WRDS.</li>
</ul>
<ul>
<li>We form the forecasts $\eefm{v_u}{\mP}$ using <a href="#eq:vForecast">(3)</a> with 500 lags of SPX RV data sourced from The Oxford-Man Institute of Quantitative Finance (<a href="http://realized.oxford-man.ox.ac.uk">http://realized.oxford-man.ox.ac.uk</a>).</li>
</ul>
<ul>
<li>We note that the actual variance swap curve is a factor (of roughly 1.4) higher than the forecast, which we may attribute to a combination of overnight movements of the index and the price of volatility risk.</li>
</ul>
<ul>
<li>Forecasts must therefore be rescaled to obtain close-to-close realized variance forecasts.</li>
</ul>
<h3 id="3-month-forecast-vs-actual-variance-swaps">3-month forecast vs actual variance swaps<a class="anchor-link" href="#3-month-forecast-vs-actual-variance-swaps">¶</a></h3><h3></h3>
<p>Figure 16: Actual (proxy) 3-month variance swap quotes in blue vs forecast in red (with no scaling factor).</p>
<h3 id="Ratio-of-actual-to-forecast">Ratio of actual to forecast<a class="anchor-link" href="#Ratio-of-actual-to-forecast">¶</a></h3><h3></h3>
<p>Figure 17: The ratio between 3-month actual variance swap quotes and 3-month forecasts.</p>
<h3 id="The-Lehman-weekend">The Lehman weekend<a class="anchor-link" href="#The-Lehman-weekend">¶</a></h3><ul>
<li><p>Empirically, it seems that the variance curve is a simple scaling factor times the forecast, but that this scaling factor is time-varying.</p>
<ul>
<li>We can think of this factor as having two multiplicative components: the overnight factor, and the price of volatility risk.</li>
</ul>
</li>
</ul>
<ul>
<li>Recall that as of the close on Friday September 12, 2008, it was widely believed that Lehman Brothers would be rescued over the weekend. By Monday morning, we knew that Lehman had failed. </li>
</ul>
<ul>
<li>In Figure 18, we see that variance swap curves just before and just after the collapse of Lehman are just rescaled versions of the RFSV forecast curves.</li>
</ul>
<h3 id="We-need-variance-swap-estimates-for-12-Sep-2008-and-15-Sep-2008">We need variance swap estimates for 12-Sep-2008 and 15-Sep-2008<a class="anchor-link" href="#We-need-variance-swap-estimates-for-12-Sep-2008-and-15-Sep-2008">¶</a></h3><p>We proxy these by taking SVI fits for the two dates and computing the log-strips.</p>
```julia
varSwaps12 =(
0.2872021, 0.2754535, 0.2601864, 0.2544684, 0.2513854, 0.2515314,
0.2508418, 0.2520099, 0.2502763, 0.2503309, 0.2580933, 0.2588361,
0.2565093)
texp12 = (
0.01916496, 0.04654346, 0.09582478, 0.19164956, 0.26830938, 0.29842574,
0.51745380, 0.54483231, 0.76659822, 0.79397673, 1.26488706, 1.76317591,
2.26146475)
varSwaps15 = (
0.4410505, 0.3485560, 0.3083603, 0.2944378, 0.2756881, 0.2747838,
0.2682212, 0.2679770, 0.2668113, 0.2706713, 0.2729533, 0.2689598,
0.2733176)
texp15 = (
0.01095140, 0.03832991, 0.08761123, 0.18343600, 0.26009582, 0.29021218,
0.50924025, 0.53661875, 0.75838467, 0.78576318, 1.25667351, 1.75496235,
2.25325120)
```
<h3 id="Actual-vs-predicted-over-the-Lehman-weekend">Actual vs predicted over the Lehman weekend<a class="anchor-link" href="#Actual-vs-predicted-over-the-Lehman-weekend">¶</a></h3>
```julia
nu = OxfordH['nu_est'][0]
h = OxfordH['h_est'][0]
date1 = dt.datetime(2008, 9, 12)
date2 = dt.datetime(2008, 9, 15)
# Variance curve fV model forecasts
tau1000 = [ float(i) * 2.5 / 1000. for i in range(1,1001)]
vs1 = varSwapForecast(date1, tau1000, nu=nu,h=h, tscale=252, onFactor=1.29)
vs2 = varSwapForecast(date2, tau1000, nu=nu,h=h, tscale=252, onFactor=1.29)
```
```julia
plt.figure(figsize=(11, 6))
plt.plot(texp12, varSwaps12, "r")
plt.plot(texp15, varSwaps15, "b")
plt.plot(tau1000, vs1, "r--")
plt.plot(tau1000, vs2, "b--");
```
<p>Figure 18: SPX variance swap curves as of September 12, 2008 (red) and September 15, 2008 (blue). The dashed curves are RFSV model forecasts rescaled by the 3-month ratio ($1.29$) as of the Friday close.</p>
<h3 id="Remarks">Remarks<a class="anchor-link" href="#Remarks">¶</a></h3><p>We note that</p>
<ul>
<li>The actual variance swaps curves are very close to the forecast curves, up to a scaling factor.</li>
</ul>
<ul>
<li>We are able to explain the change in the variance swap curve with only one extra observation: daily variance over the trading day on Monday 15-Sep-2008. </li>
</ul>
<ul>
<li>The SPX options market appears to be backward-looking in a very sophisticated way.</li>
</ul>
<h3 id="The-Flash-Crash">The Flash Crash<a class="anchor-link" href="#The-Flash-Crash">¶</a></h3><ul>
<li>The so-called Flash Crash of Thursday May 6, 2010 caused intraday realized variance to be much higher than normal. </li>
</ul>
<ul>
<li>In Figure 19, we plot the actual variance swap curves as of the Wednesday and Friday market closes together with forecast curves rescaled by the 3-month ratio as of the close on Wednesday May 5 (which was $2.52$). </li>
</ul>
<ul>
<li>We see that the actual variance curve as of the close on Friday is consistent with a forecast from the time series of realized variance that <em>includes</em> the anomalous price action of Thursday May 6. </li>
</ul>
<h3 id="Variance-swap-estimates">Variance swap estimates<a class="anchor-link" href="#Variance-swap-estimates">¶</a></h3><p>We again proxy variance swaps for 05-May-2010, 07-May-2010 and 10-May-2010 by taking SVI fits (see <span>[Gatheral and Jacquier]<sup class="reference" id="cite_ref-GatheralJacquierSSVI"><a href="#cite_note-GatheralJacquierSSVI"><span>[</span>4<span>]</span></a></sup> ) for the three dates and computing the log-strips.</a></sup></span></p>
```julia
varSwaps5 = (
0.4250369, 0.2552473, 0.2492892, 0.2564899, 0.2612677, 0.2659618, 0.2705928, 0.2761203,
0.2828139, 0.2841165, 0.2884955, 0.2895839, 0.2927817, 0.2992602, 0.3116500)
texp5 = (
0.002737851, 0.043805613, 0.120465435, 0.150581793, 0.197125257, 0.292950034,
0.369609856, 0.402464066, 0.618754278, 0.654346338, 0.867898700, 0.900752909,
1.117043121, 1.615331964, 2.631074606)
varSwaps7 = (
0.5469727, 0.4641713, 0.3963352, 0.3888213, 0.3762354, 0.3666858, 0.3615814, 0.3627013,
0.3563324, 0.3573946, 0.3495730, 0.3533829, 0.3521515, 0.3506186, 0.3594066)
texp7 = (
0.01642710, 0.03832991, 0.11498973, 0.14510609, 0.19164956, 0.28747433, 0.36413415,
0.39698836, 0.61327858, 0.64887064, 0.86242300, 0.89527721, 1.11156742, 1.60985626,
2.62559890)
varSwaps10 = (
0.3718439, 0.3023223, 0.2844810, 0.2869835, 0.2886912, 0.2905637, 0.2957070, 0.2960737,
0.3005086, 0.3031188, 0.3058492, 0.3065815, 0.3072041, 0.3122905, 0.3299425)
texp10 = (
0.008213552, 0.030116359, 0.106776181, 0.136892539, 0.183436003, 0.279260780,
0.355920602, 0.388774812, 0.605065024, 0.640657084, 0.854209446, 0.887063655,
1.103353867, 1.601642710, 2.617385352)
```
```julia
date1 = dt.datetime(2010, 5, 5)
date2 = dt.datetime(2010, 5, 7)
vsf5 = varSwapCurve(date1, bigT=2.5, nSteps=100, nu=nu, h=h, tscale=252, onFactor=2.52)
vsf7 = varSwapCurve(date2, bigT=2.5, nSteps=100, nu=nu, h=h, tscale=252, onFactor=2.52)
```
```julia
plt.figure(figsize=(11, 6))
plt.plot(texp5, varSwaps5, "r", label='May 5')
plt.plot(texp7, varSwaps7, "g", label='May 7')
plt.legend()
plt.xlabel("Time to maturity")
plt.ylabel("Variance swap quote")
plt.plot(vsf5['texp'], vsf5['vsQuote'], "r--")
plt.plot(vsf7['texp'], vsf7['vsQuote'], "g--");
```
<p>Figure 19: SPX variance swap curves as of May 5, 2010 (red) and May 7, 2010 (green). The dashed curves are RFSV model forecasts rescaled by the 3-month ratio ($2.52$) as of the close on Wednesday May 5. The curve as of the close on May 7 is consistent with the forecast <strong>including</strong> the crazy moves on May 6.</p>
<h3 id="The-weekend-after-the-Flash-Crash">The weekend after the Flash Crash<a class="anchor-link" href="#The-weekend-after-the-Flash-Crash">¶</a></h3><p>Now we plot forecast and actual variance swap curves as of the close on Friday May 7 and Monday May 10.</p>
```julia
date1 = dt.datetime(2010,5,7)
date2 = dt.datetime(2010,5,10)
vsf7 = varSwapCurve(date1, bigT=2.5, nSteps=100, nu=nu, h=h, tscale=252, onFactor=2.52)
vsf10 = varSwapCurve(date2, bigT=2.5, nSteps=100, nu=nu, h=h, tscale=252, onFactor=2.52)
```
```julia
plt.figure(figsize=(11, 6))
plt.plot(texp7, varSwaps7, "g", label='May 7')
plt.plot(texp10, varSwaps10, "m", label='May 10')
plt.legend()
plt.xlabel("Time to maturity")
plt.ylabel("Variance swap quote")
plt.plot(vsf7['texp'], vsf7['vsQuote'], "g--")
plt.plot(vsf10['texp'], vsf10['vsQuote'], "m--");
```
<p>Figure 20: The May 10 actual curve is inconsistent with a forecast that includes the Flash Crash.</p>
<p>Now let's see what happens if we exclude the Flash Crash from the time series used to generate the variance curve forecast.</p>
```julia
plt.figure(figsize=(11, 6))
ax = plt.subplot(111)
rvdata_p = rvdata.drop((dt.datetime(2010, 5, 6)), axis=0)
rvdata.loc["2010-05-04":"2010-05-10"].plot(ax=ax, legend=False)
rvdata_p.loc["2010-05-04":"2010-05-10"].plot(ax=ax, legend=False);
```
<p>Figure 21: <code>rvdata_p</code> has the May 6 realized variance datapoint eliminated (green line). Notice the crazy realized variance estimate for May 6!</p>
<p>We need a new variance curve forecast function that uses the new time series.</p>
```julia
def xip(date, tt, nu,h, tscale): # dt=(u-t) is in units of years
rvdata = pd.DataFrame(rv1['SPX2.rk'])
rvdata_p = rvdata.drop((dt.datetime(2010, 5, 6)), axis=0)
return [ forecast_XTS(rvdata_p, h=h, date=date,nLags=500,
delta=delta_t * tscale, nu=nu) for delta_t in tt]
nu = OxfordH["nu_est"][0]
h = OxfordH["h_est"][0]
def varSwapCurve_p(date, bigT, nSteps, nu, h, tscale, onFactor):
# Make vector of fwd variances
tt = [ float(i) * (bigT) / nSteps for i in range(nSteps+1)]
delta_t = tt[1]
xicurve = xip(date, tt, nu, h, tscale)
xicurve_mid = (np.array(xicurve[0:nSteps]) + np.array(xicurve[1:nSteps + 1])) / 2
xicurve_int = np.cumsum(xicurve_mid) * delta_t
varcurve1 = np.divide(xicurve_int, np.array(tt[1:]))
varcurve = np.array([xicurve[0],]+list(varcurve1))
varcurve = varcurve * onFactor * tscale # onFactor is to compensate for overnight moves
res = pd.DataFrame({"texp":np.array(tt), "vsQuote":np.sqrt(varcurve)})
return(res)
def varSwapForecast_p(date, tau, nu, h, tscale, onFactor):
vsc = varSwapCurve_p(date, bigT=2.5, nSteps=100, nu=nu, h=h,
tscale=tscale, onFactor=onFactor) # Creates the whole curve
x = vsc['texp']
y = vsc['vsQuote']
res = stineman_interp(tau, x, y, None)
return(res)
# Test the function
tau = (.25, .5 ,1, 2)
date = dt.datetime(2010, 5, 10)
varSwapForecast_p(date, tau, nu=nu, h=h, tscale=252, onFactor=1. / (1 - .35))
```
<p>Finally, we compare our new forecast curves with the actuals.</p>
```julia
date1 = dt.datetime(2010, 5, 7)
date2 = dt.datetime(2010, 5, 10)
vsf7 = varSwapCurve(date1, bigT=2.5, nSteps=100, nu=nu, h=h, tscale=252, onFactor=2.52)
vsf10p = varSwapCurve_p(date2, bigT=2.5, nSteps=100, nu=nu, h=h, tscale=252, onFactor=2.52)
```
```julia
plt.figure(figsize=(11, 6))
plt.plot(texp7, varSwaps7, "g", label='May 7')
plt.plot(texp10, varSwaps10, "m", label='May 10')
plt.legend()
plt.xlabel("Time to maturity")
plt.ylabel("Variance swap quote")
plt.plot(vsf7['texp'], vsf7['vsQuote'], "g--")
plt.plot(vsf10p['texp'], vsf10p['vsQuote'], "m--");
```
<p>Figure 22: The May 10 actual curve is consistent with a forecast that excludes the Flash Crash.</p>
<h3 id="Resetting-of-expectations-over-the-weekend">Resetting of expectations over the weekend<a class="anchor-link" href="#Resetting-of-expectations-over-the-weekend">¶</a></h3><ul>
<li>In Figures 20 and 22, we see that the actual variance swap curve on Monday, May 10 is consistent with a forecast that excludes the Flash Crash.</li>
</ul>
<ul>
<li>Volatility traders realized that the Flash Crash should not influence future realized variance projections.</li>
</ul>
<h3 id="Summary">Summary<a class="anchor-link" href="#Summary">¶</a></h3><ul>
<li><p>We uncovered a remarkable monofractal scaling relationship in historical volatility.</p>
<ul>
<li>A corollary is that volatility is not a long memory process, as widely believed.</li>
</ul>
</li>
</ul>
<ul>
<li>This leads to a natural non-Markovian stochastic volatility model under $\mP$.</li>
</ul>
<ul>
<li>The simplest specification of $\frac{d\mQ}{d\mP}$ gives a non-Markovian generalization of the Bergomi model.</li>
</ul>
<ul>
<li>The history of the Brownian motion $\lbrace W_s, s<t curve="" encoded="" for="" forward="" in="" is="" market.="" observed="" pricing="" required="" the="" variance="" which="">
</t></li></ul>
<ul>
<li>This model fits the observed volatility surface surprisingly well with very few parameters.</li>
</ul>
<ul>
<li>For perhaps the first time, we have a simple consistent model of historical and implied volatility.</li>
</ul>
<h2 id="References">References<a class="anchor-link" href="#References">¶</a></h2><p><br/></p>
<div class="reflist" style="list-style-type: decimal;">
<ol>
<li id="cite_note-ABDE"><span class="mw-cite-backlink"><b><a href="#cite_ref-ABDE">^</a></b></span>
Torben G Andersen, Tim Bollerslev, Francis X Diebold, and Heiko Ebens, The distribution of realized stock return volatility, *Journal of Financial Economics* **61**(1) 43-76 (2001).
</li>
<li id="cite_note-BayerFriz"><span class="mw-cite-backlink"><b><a href="#cite_ref-BayerFriz">^</a></b></span>
Christian Bayer, Peter Friz and Jim Gatheral, Pricing under rough volatility, *Quantitative Finance* forthcoming, available at http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2554754, (2015).
</li>
<li id="cite_note-BacryMuzy"><span class="mw-cite-backlink"><b><a href="#cite_ref-BacryMuzy">^</a></b></span>
Emmanuel Bacry and Jean-François Muzy, Log-infinitely divisible multifractal processes,
*Communications in Mathematical Physics* **236**(3) 449-475 (2003).</li>
<li id="cite_note-GatheralJacquierSSVI"><span class="mw-cite-backlink"><b><a href="#cite_ref-GatheralJacquierSSVI">^</a></b></span> Jim Gatheral and Antoine Jacquier, Arbitrage-free SVI volatility
surfaces, <span>*Quantitative Finance*</span> <span>**14**</span>(1) 59-71 (2014).</li>
<li id="cite_note-GJR"><span class="mw-cite-backlink"><b><a href="#cite_ref-GJR">^</a></b></span> Jim Gatheral, Thibault Jaisson and Mathieu Rosenbaum, Volatility is rough, available at http://papers.ssrn.com/sol3/papers.cfm?abstract_id=2509457, (2014).</li>
<li id="cite_note-GO"><span class="mw-cite-backlink"><b><a href="#cite_ref-GO">^</a></b></span> Jim Gatheral and Roel Oomen, Zero-intelligence realized variance estimation, *Finance and Stochastics* **14**(2) 249-283 (2010).</li>
<li id="cite_note-NuzmanPoor"><span class="mw-cite-backlink"><b><a href="#cite_ref-NuzmanPoor">^</a></b></span> Carl J. Nuzman and H. Vincent Poor, Linear estimation of self-similar processes via Lamperti’s transformation, *Journal of Applied Probability* **37**(2) 429-452 (2000).</li>
</ol>
</div>
|
import analysis.special_functions.trigonometric.basic
import analysis.normed_space.lp_space
import data.fin.vec_notation
import to_mathlib.combinatorics.simple_graph.cyclic
import to_mathlib.combinatorics.simple_graph.shannon_capacity
noncomputable theory
open set function real simple_graph
open_locale real_inner_product_space
local notation `𝔼³` := euclidean_space ℝ $ fin 3
local notation `𝔾₅` := simple_graph.cyclic 5
/-- Standard basis element. -/
def e₁ : 𝔼³ := euclidean_space.single 0 1
/-- Standard basis element. -/
def e₂ : 𝔼³ := euclidean_space.single 1 1
/-- Standard basis element. -/
def e₃ : 𝔼³ := euclidean_space.single 2 1
@[simp] lemma norm_e₁ : ∥e₁∥ = 1 :=
by simp [e₁, euclidean_space.norm_eq, finset.filter_eq']
/-- The Lovász umbrella. -/
def lovasz_umbrella : orthogonal_representation 𝔾₅ 𝔼³ :=
{ to_fun := λ i j, sorry, -- See: https://en.wikipedia.org/wiki/Lov%C3%A1sz_number#Relation_to_Shannon_capacity
norm_eq_one' := sorry,
inner_eq_zero_of_ne_of_not_adj' := sorry, }
/-- Proving this will probably require explicit results about the sine or cosine of
`π / 5`, `2 * π / 5`, etc. -/
@[simp] lemma inner_lovasz_umbrella_e₁ (i : fin 5) :
⟪lovasz_umbrella i, e₁⟫^2 = 1 / sqrt 5 :=
sorry
@[simp] lemma lovasz_number_at_lovasz_umbrella_eq :
lovasz_umbrella.lovasz_number_at e₁ = sqrt 5 :=
begin
dunfold simple_graph.orthogonal_representation.lovasz_number_at,
simp_rw [inner_lovasz_umbrella_e₁, ←inv_eq_one_div, div_inv_eq_mul],
rw [show ∥e₁∥ = 1, from _],
simp_rw [pow_two, one_mul],
rw [supr, real.Sup_def, dif_pos],
generalize_proofs h,
refine le_antisymm _ _,
{ refine h.some_spec.2 _, rintros _ ⟨y, rfl⟩, exact le_refl _, },
{ exact h.some_spec.1 ⟨0, rfl⟩, },
{ refine ⟨⟨_, ⟨0, rfl⟩⟩, ⟨sqrt 5, _⟩⟩,
rintros _ ⟨y, rfl⟩, refl, },
{ erw [norm_eq_sqrt_real_inner, sqrt_eq_iff_mul_self_eq, one_mul,
euclidean_space.inner_single_left, map_one, one_mul],
dunfold e₁, rw [euclidean_space.single_apply, if_pos rfl],
exact real_inner_self_nonneg, norm_num },
end
abbreviation max_independent_set : set (fin 2 → fin 5) := { ![0,0], ![1,2], ![2, 4], ![3, 1], ![4, 3] }
lemma mem_max_independent_set (i : fin 2 → fin 5) :
i ∈ max_independent_set ↔ i = ![0,0] ∨ i = ![1,2] ∨ i = ![2, 4] ∨ i = ![3, 1] ∨ i = ![4, 3] :=
by rw [mem_insert_iff, mem_insert_iff, mem_insert_iff, mem_insert_iff, mem_singleton_iff]
lemma card_max_independent_set : nat.card max_independent_set = 5 :=
begin
rw [nat.card_eq_fintype_card, card_insert, card_insert, card_insert, card_insert, card_singleton],
{ simp only [mem_singleton_iff], intros r, have : (3 : fin 5) = 4 := congr_fun r 0,
rw fin.ext_iff at this, change 3 = 4 at this, norm_num at this, },
{ intro r, rw [mem_insert_iff, mem_singleton_iff] at r,
rcases r with r|r;
have := congr_fun r 0;
simp only [matrix.cons_val_zero] at this; norm_num at this, },
{ intro r, rw [mem_insert_iff, mem_insert_iff, mem_singleton_iff] at r,
rcases r with r|r|r;
have := congr_fun r 0;
simp only [matrix.cons_val_zero] at this; norm_num at this, },
{ intro r, rw [mem_insert_iff, mem_insert_iff, mem_insert_iff, mem_singleton_iff] at r,
rcases r with r|r|r|r;
have := congr_fun r 0;
simp only [matrix.cons_val_zero] at this; norm_num at this, },
end
lemma max_independent_set_is_independent :
(⊠^2 (cyclic 5)).independent_set max_independent_set :=
begin
rintros ⟨i, hi⟩ ⟨j, hj⟩, rw [subtype.coe_mk, subtype.coe_mk],
rw mem_max_independent_set at hi hj,
rcases hi with hi|hi|hi|hi|hi;
rcases hj with hj|hj|hj|hj|hj;
rw [hi, hj],
all_goals { try { simp only [simple_graph.irrefl, not_false_iff] }, },
all_goals { simp only [strong_pi_adj, ne.def, not_and, not_forall], intros h, push_neg, },
all_goals { try { refine ⟨1, _⟩, split; simp only [matrix.cons_val_one, matrix.head_cons, ne.def], norm_num,
exact not_cyclic_5_adj_0_2 } },
all_goals { try { refine ⟨0, _⟩, split; simp only [matrix.cons_val_zero, ne.def], norm_num,
exact not_cyclic_5_adj_0_2 } },
all_goals { try { refine ⟨0, _⟩, split; simp only [matrix.cons_val_zero, ne.def], norm_num,
exact not_cyclic_5_adj_0_3 } },
all_goals { try { refine ⟨1, _⟩, split; simp only [matrix.cons_val_one, matrix.head_cons, ne.def], norm_num,
exact not_cyclic_5_adj_0_3 } },
end
lemma strong_pow_two_independence_number :
5 ≤ (⊠^2 (cyclic 5)).independence_number :=
begin
rw [independence_number_eq_bcsupr, supr],
apply le_cSup, swap,
{ refine ⟨max_independent_set, _⟩, dsimp only,
rw nat.supr_pos, apply card_max_independent_set,
apply max_independent_set_is_independent },
let s : set ℕ := _, suffices : bdd_above s, exact this,
apply fintype.bdd_above_range,
end
/-- The easier direction.
Easy on paper, not necessarily in Lean. -/
lemma le_shannon_capacity_cyclic_graph_five :
sqrt 5 ≤ shannon_capacity 𝔾₅ :=
begin
dunfold shannon_capacity, rw [supr],
rw le_cSup_iff,
{ intros b hb,
have := (lovasz_umbrella).independence_number_le_lovasz_number_at e₁,
specialize @hb _ ⟨1, rfl⟩, dsimp only at hb,
rw [show 1 + 1 = 2, from rfl, show (↑(1 : ℕ) : ℝ) = 1, by norm_cast,
show (1 : ℝ) + 1 = 2, by norm_cast, ←sqrt_eq_rpow, sqrt_le_iff] at hb,
have h2 : (5 : ℝ) ≤ (⊠^2 (cyclic 5)).independence_number :=
by exact_mod_cast strong_pow_two_independence_number,
rw sqrt_le_iff, refine ⟨hb.1, h2.trans hb.2⟩ },
{ refine ⟨sqrt 5, _⟩, rintros _ ⟨k, rfl⟩, dsimp only,
have H := (lovasz_umbrella.pow (k+1)).independence_number_le_lovasz_number_at
(tensor_power.tpow ℝ (λ _, e₁)),
rw [orthogonal_representation.pow_lovasz_number_at', lovasz_number_at_lovasz_umbrella_eq] at H,
refine (real.rpow_le_rpow _ H _).trans _,
{ norm_cast, exact nat.zero_le _, },
{ rw div_nonneg_iff, left, split, norm_num, norm_cast, exact nat.zero_le _, },
{ rw [show sqrt 5 ^ (k + 1) = sqrt 5 ^ (k + 1 : ℝ), by norm_cast, ←real.rpow_mul,
mul_one_div_cancel, rpow_one], norm_cast,
linarith, exact sqrt_nonneg _, }, },
{ exact ⟨_, ⟨1, rfl⟩⟩, },
end
/-- The harder direction. -/
lemma shannon_capacity_cyclic_graph_five_le :
shannon_capacity 𝔾₅ ≤ sqrt 5 :=
begin
apply (shannon_capacity_le_lovasz_number_at 𝔾₅ lovasz_umbrella e₁).trans,
apply lovasz_number_at_lovasz_umbrella_eq.le,
end
/-- *Main project goal* -/
@[simp] lemma shannon_capacity_cyclic_graph_five_eq :
shannon_capacity 𝔾₅ = sqrt 5 :=
le_antisymm shannon_capacity_cyclic_graph_five_le le_shannon_capacity_cyclic_graph_five
/- The `#print` statement below currently produces:
```
classical.choice
quot.sound
propext
[sorry]
```
Our goal is to get it to stop printing the line saying `[sorry]`.
-/
#print axioms shannon_capacity_cyclic_graph_five_eq
|
State Before: m n k : ℕ
h : k < n
⊢ ↑(finRotate (n + 1)) { val := k, isLt := (_ : k < n + 1) } = { val := k + 1, isLt := (_ : Nat.succ k < Nat.succ n) } State After: case h
m n k : ℕ
h : k < n
⊢ ↑(↑(finRotate (n + 1)) { val := k, isLt := (_ : k < n + 1) }) =
↑{ val := k + 1, isLt := (_ : Nat.succ k < Nat.succ n) } Tactic: ext State Before: case h
m n k : ℕ
h : k < n
⊢ ↑(↑(finRotate (n + 1)) { val := k, isLt := (_ : k < n + 1) }) =
↑{ val := k + 1, isLt := (_ : Nat.succ k < Nat.succ n) } State After: case h
m n k : ℕ
h : k < n
⊢ ↑(↑finAddFlip { val := k, isLt := (_ : k < n + 1) }) = k + 1 Tactic: dsimp [finRotate_succ] State Before: case h
m n k : ℕ
h : k < n
⊢ ↑(↑finAddFlip { val := k, isLt := (_ : k < n + 1) }) = k + 1 State After: no goals Tactic: simp [finAddFlip_apply_mk_left h, add_comm] |
From mathcomp
Require Import ssreflect.
Section ModusPonens.
Variables X Y : Prop.
Hypothesis XtoY_is_true : X -> Y.
Hypothesis X_is_true : X.
Theorem MP : Y.
Proof.
move: X_is_true.
by [].
Qed.
End ModusPonens.
Section HilbertSAxiom.
Variables A B C : Prop.
Theorem HS1 : (A -> (B -> C)) -> ((A -> B) -> (A -> C)).
Proof.
move=> AtoBtoC_is_true.
move=> AtoB_is_true.
move=> A_is_true.
apply: (MP B C).
apply: (MP A (B -> C)).
by [].
by [].
apply: (MP A B).
by [].
by [].
Qed.
Theorem HS2 : (A -> (B -> C)) -> ((A -> B) -> (A -> C)).
Proof.
move=> AtoBtoC_is_true AtoB_is_true A_is_true.
by apply: (MP B C); [apply: (MP A (B -> C)) | apply: (MP A B)].
Qed.
Theorem HS3 : (A -> (B -> C)) -> ((A -> B) -> (A -> C)).
Proof.
move=> AtoBtoC_is_true AtoB_is_true A_is_true.
by move: A_is_true (AtoB_is_true A_is_true).
Qed.
End HilbertSAxiom.
|
{-# language OverloadedStrings #-}
module Report (generateReports) where
import Graphics.Vega.VegaLite hiding (Sum)
import Prelude hiding (filter, lookup, repeat)
import Data.Monoid (Sum(..))
import Numeric.LinearAlgebra ((#>), Vector, toList)
import Data.Maybe
import GA
import Fitness
-- | Plot the evolution of average fitness along the generations
plotEvo :: [Double] -> IO ()
plotEvo avgs =
let gens = [1.0 .. fromIntegral (length avgs)]
plotData = dataFromColumns []
. dataColumn "generation" (Numbers gens)
. dataColumn "avg" (Numbers avgs)
$ []
enc = encoding
. position X [ PName "generation", PmType Quantitative]
. position Y [ PName "avg", PmType Quantitative]
$ []
in toHtmlFile "evolution.html" $ toVegaLite [ plotData, mark Line [], enc, height 800, width 600 ]
plotPoly :: [[Double]] -> Vector Double -> Solution (Poly n) -> IO ()
plotPoly xss ys sol =
let x0 = map head xss
zss = decode xss (map _getPoly $ _chromo sol)
ysHat = toList $ zss #> (fromJust . _coeffs) sol
ys' = toList ys
clusters = replicate (length x0) "poly" ++ replicate (length x0) "real"
plotData = dataFromColumns []
. dataColumn "x0" (Numbers $ x0 ++ x0)
. dataColumn "y" (Numbers $ ysHat ++ ys')
. dataColumn "Cluster" (Strings clusters)
$ []
enc = encoding
. position X [ PName "x0", PmType Quantitative]
. position Y [ PName "y", PmType Quantitative]
. color [ MName "Cluster", MmType Nominal ]
$ []
in toHtmlFile "poly.html" $ toVegaLite [ plotData, mark Line [], enc, height 800, width 600 ]
generateReports :: [[Double]] -> Vector Double -> [Double] -> Solution (Poly n) -> IO ()
generateReports xss ys avgs best = do plotEvo avgs
plotPoly xss ys best
|
Require Import Coq.Program.Basics.
Require Import Coq.Strings.String.
Require Import Setoid.
Require Import ZArith.
Require Import Coq.Program.Equality.
Require Import Lia.
Require Import FinProof.All.
Require Import UMLang.All.
Require Import UrsusStdLib.Solidity.All.
Require Import UrsusTVM.Solidity.All.
Require Import UrsusDefinitions.
Import UrsusNotations.
Local Open Scope xlist_scope.
Local Open Scope record.
Local Open Scope program_scope.
Local Open Scope glist_scope.
Local Open Scope ursus_scope.
Local Open Scope usolidity_scope.
Interfaces.
MakeInterface Class IOnPoolActivated :=
{
onPoolActivated : external PhantomType false
}.
EndInterfaces.
|
lemma of_real_mult [simp]: "of_real (x * y) = of_real x * of_real y" |
/*
* Copyright 2010 Vicente J. Botet Escriba
* Copyright (c) Microsoft Corporation 2014
* Copyright 2015 Andrey Semashev
*
* Distributed under the Boost Software License, Version 1.0.
* See http://www.boost.org/LICENSE_1_0.txt
*/
#ifndef BOOST_WINAPI_SYSTEM_HPP_INCLUDED_
#define BOOST_WINAPI_SYSTEM_HPP_INCLUDED_
#include <boost/winapi/basic_types.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
#if defined(BOOST_MSVC)
#pragma warning(push)
// nonstandard extension used : nameless struct/union
#pragma warning(disable: 4201)
#endif
#if !defined( BOOST_USE_WINDOWS_H )
extern "C" {
struct _SYSTEM_INFO;
#if BOOST_WINAPI_PARTITION_APP_SYSTEM
BOOST_SYMBOL_IMPORT boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC
GetSystemInfo(::_SYSTEM_INFO* lpSystemInfo);
#endif
#if BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM
#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WINXP
BOOST_SYMBOL_IMPORT boost::winapi::VOID_ BOOST_WINAPI_WINAPI_CC
GetNativeSystemInfo(::_SYSTEM_INFO* lpSystemInfo);
#endif
#endif
}
#endif
namespace boost {
namespace winapi {
typedef struct BOOST_MAY_ALIAS _SYSTEM_INFO {
BOOST_WINAPI_DETAIL_EXTENSION union {
DWORD_ dwOemId;
BOOST_WINAPI_DETAIL_EXTENSION struct {
WORD_ wProcessorArchitecture;
WORD_ wReserved;
};
};
DWORD_ dwPageSize;
LPVOID_ lpMinimumApplicationAddress;
LPVOID_ lpMaximumApplicationAddress;
DWORD_PTR_ dwActiveProcessorMask;
DWORD_ dwNumberOfProcessors;
DWORD_ dwProcessorType;
DWORD_ dwAllocationGranularity;
WORD_ wProcessorLevel;
WORD_ wProcessorRevision;
} SYSTEM_INFO_, *LPSYSTEM_INFO_;
#if BOOST_WINAPI_PARTITION_APP_SYSTEM
BOOST_FORCEINLINE VOID_ GetSystemInfo(LPSYSTEM_INFO_ lpSystemInfo)
{
::GetSystemInfo(reinterpret_cast< ::_SYSTEM_INFO* >(lpSystemInfo));
}
#endif
#if BOOST_WINAPI_PARTITION_APP || BOOST_WINAPI_PARTITION_SYSTEM
#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WINXP
BOOST_FORCEINLINE VOID_ GetNativeSystemInfo(LPSYSTEM_INFO_ lpSystemInfo)
{
::GetNativeSystemInfo(reinterpret_cast< ::_SYSTEM_INFO* >(lpSystemInfo));
}
#endif
#endif
}
}
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
#endif // BOOST_WINAPI_SYSTEM_HPP_INCLUDED_
|
(* This file is generated by Why3's Coq driver *)
(* Beware! Only edit allowed sections below *)
Require Import ZArith.
Require Import Rbase.
Definition unit := unit.
Parameter qtmark : Type.
Parameter at1: forall (a:Type), a -> qtmark -> a.
Implicit Arguments at1.
Parameter old: forall (a:Type), a -> a.
Implicit Arguments old.
Inductive list (a:Type) :=
| Nil : list a
| Cons : a -> (list a) -> list a.
Set Contextual Implicit.
Implicit Arguments Nil.
Unset Contextual Implicit.
Implicit Arguments Cons.
Set Implicit Arguments.
Fixpoint mem (a:Type)(x:a) (l:(list a)) {struct l}: Prop :=
match l with
| Nil => False
| (Cons y r) => (x = y) \/ (mem x r)
end.
Unset Implicit Arguments.
Set Implicit Arguments.
Fixpoint infix_plpl (a:Type)(l1:(list a)) (l2:(list a)) {struct l1}: (list
a) :=
match l1 with
| Nil => l2
| (Cons x1 r1) => (Cons x1 (infix_plpl r1 l2))
end.
Unset Implicit Arguments.
Axiom Append_assoc : forall (a:Type), forall (l1:(list a)) (l2:(list a))
(l3:(list a)), ((infix_plpl l1 (infix_plpl l2
l3)) = (infix_plpl (infix_plpl l1 l2) l3)).
Axiom Append_l_nil : forall (a:Type), forall (l:(list a)), ((infix_plpl l
(Nil:(list a))) = l).
Set Implicit Arguments.
Fixpoint length (a:Type)(l:(list a)) {struct l}: Z :=
match l with
| Nil => 0%Z
| (Cons _ r) => (1%Z + (length r))%Z
end.
Unset Implicit Arguments.
Axiom Length_nonnegative : forall (a:Type), forall (l:(list a)),
(0%Z <= (length l))%Z.
Axiom Length_nil : forall (a:Type), forall (l:(list a)),
((length l) = 0%Z) <-> (l = (Nil:(list a))).
Axiom Append_length : forall (a:Type), forall (l1:(list a)) (l2:(list a)),
((length (infix_plpl l1 l2)) = ((length l1) + (length l2))%Z).
Axiom mem_append : forall (a:Type), forall (x:a) (l1:(list a)) (l2:(list a)),
(mem x (infix_plpl l1 l2)) <-> ((mem x l1) \/ (mem x l2)).
Axiom mem_decomp : forall (a:Type), forall (x:a) (l:(list a)), (mem x l) ->
exists l1:(list a), exists l2:(list a), (l = (infix_plpl l1 (Cons x l2))).
Parameter map : forall (a:Type) (b:Type), Type.
Parameter get: forall (a:Type) (b:Type), (map a b) -> a -> b.
Implicit Arguments get.
Parameter set: forall (a:Type) (b:Type), (map a b) -> a -> b -> (map a b).
Implicit Arguments set.
Axiom Select_eq : forall (a:Type) (b:Type), forall (m:(map a b)),
forall (a1:a) (a2:a), forall (b1:b), (a1 = a2) -> ((get (set m a1 b1)
a2) = b1).
Axiom Select_neq : forall (a:Type) (b:Type), forall (m:(map a b)),
forall (a1:a) (a2:a), forall (b1:b), (~ (a1 = a2)) -> ((get (set m a1 b1)
a2) = (get m a2)).
Parameter const: forall (b:Type) (a:Type), b -> (map a b).
Set Contextual Implicit.
Implicit Arguments const.
Unset Contextual Implicit.
Axiom Const : forall (b:Type) (a:Type), forall (b1:b) (a1:a), ((get (const(
b1):(map a b)) a1) = b1).
Inductive array (a:Type) :=
| mk_array : Z -> (map Z a) -> array a.
Implicit Arguments mk_array.
Definition elts (a:Type)(u:(array a)): (map Z a) :=
match u with
| (mk_array _ elts1) => elts1
end.
Implicit Arguments elts.
Definition length1 (a:Type)(u:(array a)): Z :=
match u with
| (mk_array length2 _) => length2
end.
Implicit Arguments length1.
Definition get1 (a:Type)(a1:(array a)) (i:Z): a := (get (elts a1) i).
Implicit Arguments get1.
Definition set1 (a:Type)(a1:(array a)) (i:Z) (v:a): (array a) :=
match a1 with
| (mk_array xcl0 _) => (mk_array xcl0 (set (elts a1) i v))
end.
Implicit Arguments set1.
Inductive tree :=
| Empty : tree
| Node : tree -> tree -> tree .
Set Implicit Arguments.
Fixpoint size(t:tree) {struct t}: Z :=
match t with
| Empty => 0%Z
| (Node l r) => ((1%Z + (size l))%Z + (size r))%Z
end.
Unset Implicit Arguments.
(* YOU MAY EDIT THE CONTEXT BELOW *)
(* DO NOT EDIT BELOW *)
Theorem size_nonneg : forall (t:tree), (0%Z <= (size t))%Z.
(* YOU MAY EDIT THE PROOF BELOW *)
induction t; intuition.
unfold size; fold size; omega.
Qed.
(* DO NOT EDIT BELOW *)
|
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{a4paper}
\usepackage{setspace}
\usepackage{enumerate}
\usepackage{enumitem}
\usepackage{hyperref}
\usepackage[toc]{glossaries}
\hypersetup{colorlinks,allcolors=black,urlcolor=blue}
\setenumerate[1]{itemsep=0pt,partopsep=2pt,parsep=0pt ,topsep=2pt}
\setitemize[1]{itemsep=0pt,partopsep=2pt,parsep=0pt ,topsep=2pt}
\setenumerate[2]{itemsep=0pt,partopsep=2pt,parsep=0pt ,topsep=2pt}
\setitemize[2]{itemsep=0pt,partopsep=2pt,parsep=0pt ,topsep=2pt}
\setdescription{itemsep=0pt,partopsep=2pt,parsep=0pt ,topsep=2pt}
\usepackage{graphicx}
\usepackage{fontspec}
\defaultfontfeatures{%
RawFeature={%
% +swsh,
+calt
}%
}
\setmainfont{EB Garamond}
\usepackage{multicol}
\usepackage{float}
\usepackage[semibold]{sourcecodepro}
\usepackage{xcolor}
\usepackage{minted}
\usemintedstyle{friendly}
\definecolor{bg}{rgb}{0.95,0.95,0.95}
\newcommand{\codeinline}[1]{
\mintinline[bgcolor=bg, fontsize=\scriptsize]{text}{#1}
}
\usepackage{relsize}
\newcommand{\bigdataVs}[1]{
\subsection{#1}
}
\newenvironment{console}{% Caution:
\VerbatimEnvironment
\begin{minted}[xleftmargin=2em,bgcolor=bg,fontsize=\small]{console}% Do NOT delete these comments
}% Otherwise there will be error when compiling
{%
\end{minted}%
}
%-----------%
\title{NoSQL Proof-of-Concept Proposal -- Dota2 Game Replay Analysis}
\author{
Team name: PSG.LGD \\ \\
Yichun Yan \\
Ziwei Jiang \\
Yifan Li \\
Weiqi Wang
}
\date{\today}
\makeglossaries
\newglossaryentry{Ancient}
{
name={Ancient},
description={(also commonly refered to as Thrones, or Tree for Radiant's ancient and Throne for Dire's ancient, as legacy names from DotA) are massive structures found inside each faction's base and are the main objective. In order to win, the enemy team's Ancient must be destroyed, while the own one must be kept alive. Ancients are guarded by their two tier 4 towers. The Ancients are invulnerable until both of their tier 4 towers are destroyed.}
}
\newglossaryentry{MOBA}
{
name={MOBA},
description={also known as action real-time strategy (ARTS), is a subgenre of strategy video games that originated as a subgenre of real-time strategy in which each player controls a single character, usually on a map in an isometric perspective, as part of a team competing against another team of players.}
}
\newglossaryentry{professional matches}
{
name={professional matches},
description={Matches played two professional teams hosted officially by Valve.}
}
\newglossaryentry{public matches}
{
name={public matches},
description={Matches played by ten randomly chosen players, and the results won't influence Matchmaking Rating(MMR) of each player.}
}
\newglossaryentry{ranked matches}
{
name={ranked matches},
description={Matches played by ten randomly chosen players according to their Matchmaking Rating(MMR), and the results will influence the Matchmaking Rating of each player.}
}
\newglossaryentry{gold}
{
name={gold},
description={Gold is the currency used to buy items or instantly revive your hero. Gold can be earned from killing heroes, creeps, or buildings.}
}
\newglossaryentry{creeps}
{
name={creeps},
description={Creeps are basic units in Dota 2. Every unit which is not a hero, building, ward or courier is considered a creep. Creeps can belong to either faction, be neutral, or be player-controlled units. Unlike heroes, creeps do not gain experience and cannot level up. All of their stats are set values (though can still be altered by modifiers). Most creeps grant a set gold and experience bounty to heroes when killed.}
}
\newglossaryentry{XP}
{
name={XP},
description={A shorthand for experience. Experience is an element heroes can gather by killing enemy units, or being present as enemy units get killed. On its own, experience does nothing, but when accumulated, it increases the hero's level, so that they grow more powerful. Only heroes can gather experience and therefore reach higher levels. With each level gained, a hero's base attributes increase by static values (unique for each hero), which makes them stronger in several.}
}
\newglossaryentry{match id}
{
name={match id},
description={A unique identifier for each match played on Dota2.}
}
\newglossaryentry{sequence number}
{
name={sequence number},
description={Similar to match id, which is a unique identifier for each match. But this field will not show up in the Dota2's client.}
}
\newglossaryentry{towers}
{
name={towers},
description={Towers are the main line of defense for both teams, attacking any non-neutral enemy that gets within their range. Both factions have all three lanes guarded by three towers each.}
}
\newglossaryentry{barracks}
{
name={barracks},
description={Barracks (commonly shortened to Rax) are buildings, defended by their tier 3 towers, that are responsible for keeping lane creeps as powerful as their counterparts.}
}
\newglossaryentry{lane}
{
name={lane},
description={A Lane is one of three paths connecting the two Ancients. Lane creeps will push along these lanes after spawning.}
}
\newglossaryentry{AFK}
{
name={AFK},
description={A shorthand for away-from-keyboard, AFK means a player leaving a match early before it's end.}
}
\newglossaryentry{buff}
{
name={buff},
description={Buffs are positive status effects that enhance your hero.}
}
\newglossaryentry{debuff}
{
name={debuff},
description={Debuffs are negative status effects that weaken your hero.}
}
\newglossaryentry{mode}
{
name={mode},
description={Game modes are a set of restrictions within which the game of Dota 2 can be played. Most game modes alter how heroes are picked by players. There are also some novelty modes that allow 1v1 play, or give a player a new hero every time they die, for example. }
}
\newglossaryentry{ban}
{
name={ban},
description={A ban will disallow the choose for a specific hero within a match.}
}
\newglossaryentry{pick}
{
name={pick},
description={A pick is choosing a hero that a player want to play within a match.}
}
\newglossaryentry{first-blood}
{
name={first-blood},
description={The first kill within a game. The player who makes the first kill will be rewarded with 150 extra gold}.
}
\newglossaryentry{team battle}
{
name={team battle},
description={A battle involves more than half of the players in a match within a short period of time}.
}
\newglossaryentry{buyback}
{
name={buyback},
description={While dead, the player has the option to use ``buyback", spending money in order to instantly respawn at the fountain. However, the buyback ability has a long cooldown of 480 seconds and has a scaling gold cost.}.
}
\newglossaryentry{last-hit}
{
name={last-hit},
description={You can only get gold from killing creeps or get a kill from killing a hero if you make the last-hit that cause the creeps or hero to death.}.
}
\begin{document}
\maketitle
\tableofcontents
\clearpage
%-------%
\section{Project Background}
Our team aims at exploring data about a popular and long-lived computer game, Dota2. Dota2 is a multiplayer online battle arena (\gls{MOBA}) video game developed and published by Valve Corporation. Each game will involves ten players that are divided to two teams play against each other on a same map. Every player chooses one ``hero" that has unique abilities and different styles of playing. The aim for each team is to destroy the building called ``\gls{Ancient}" of the other team. Players collect \gls{gold} to buy powerful items and gain \gls{XP} by killing players on the other team, destroy building of the other team, or kill \gls{creeps}.
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{pic/combat.png}
\caption{A screenshot of the game}
\end{figure}
This game has a large quantity of players, accordingly a huge amount of replays will be produced every day. Also, it's a real-time game, hundreds of operations and some decisions will be made each second, and all of them will have some influence on the final results of the game. Both of the above two features make the game a great subject to big data analysis. Actually, there are some professional teams start hiring data engineers to help their players perform better in a game. This means that our analysis has some realistic meaning.
Knowing that this game is not familiar to everybody, and we may use some words that may be difficult to understand to those who don't play this kind of games for simplicity. I create a glossary at the end of this proposal for your reference.
\section{Potential Datasets}
We will mainly use two datasets:
\begin{enumerate}
\item \href{https://wiki.teamfortress.com/wiki/WebAPI/GetMatchDetails}{Dota2 match result dataset}
\item \href{https://wiki.teamfortress.com/wiki/Replay}{Dota2 replay dataset}
\end{enumerate}
The first dataset is the snapshot of the final state of each player and the whole game, containing only important information.
The second one is a binary format file which can be executed by Dota2's client to reproduce everything happened in the game.
The datasets can be retrieved from the following resources:
\begin{enumerate}
\item Valve's Dota2 replay servers
\item \href{https://wiki.teamfortress.com/wiki/WebAPI}{Valve's official API}
\end{enumerate}
We will get the match results data from Valve's official API.
It also provides a key, which we can use to retrieve a replay from the replay server.
In all, we will have two different kinds of data for our further analysis, relatively large-scale but coarse-grained match results data, and very fine-grained replays data.
Considering the file size of one replay, we decide to include recent professional games and randomly select some public games for the replay data.
We will mention how we acquire the data in Data ETL section.
\section{Five Vs of Datasets}
To assess the adequacy of adopting big data to our project, we firstly identify five Vs characteristics of our dataset.
\bigdataVs{Volume}
Replays are one of the datasets we plan to use, which are the full records of finished matches. The size of one replay is estimated to be about 60MB. We plan to collect 3000 replays whose size is about 180GB. As for match result data which is JSON-format data, the size of each result is about 5KB. We plan to collect 10,000,000 match results whose size is about 50GB. Moreover, if we desire more data in future implementation, we can always access it as long as Dota2 still has players.
\bigdataVs{Velocity}
According to the statistic data in August 2019 from Steam which is a video game digital distribution platform, the average number of players is 467,148.3 players and the peak number is 826,690.
A large number of players makes both the replay data and result data high-velocity.
Although in our project, the velocity depends on the velocity of the API request, this statistic data reveals that it's potential to be high-velocity.
\bigdataVs{Variety}
From the APIs mentioned above, we can access JSON format files, the match result data, and binary format files, the replay data.
\bigdataVs{Veracity}
The overall quality of our datasets is good because we access most of them from the official API.
But there is still a few noises.
For example, the time of some games is too short, which makes these game lack of representativeness.
Thus, we plan to implement data validation to filter the undesired matches.
\bigdataVs{Value}
Dota2 game statistics and replays data are valuable.
Professional teams may use it to analyze the performance of team members or design new strategies for competitions.
Amateur players can also learn a lot about the techniques, timing, hero choice from the data.
Our business questions, will focus on these aspects to provide valuable insights.
Even though the game is versioning, our datasets can be useful for a relatively long time.
Because we plan to collect 1/3 \gls{professional matches} and 1/3 \gls{public matches}, 1/3 \gls{ranked matches}.
The professional matches are durable since we can always extract information about professional teams and players from them.
As for the public games, they are valuable as long as they are not too stale. Minor changes of the game does not affect the whole picture.
But we will filter out public games which are too outdated in the data validation step, in order to make our datasets more valuable.
\section{Potential Business Questions}
As mentioned before, we can collect 2 kinds of data, one is match results and one is replays.
By analyzing them, the following questions might be answered.
\begin{itemize}
\item Easy questions:
\begin{itemize}
\item Who is the hero gaining \gls{gold}/\gls{XP} fastest in 15 minutes in public games/professional games?
\item Who is the hero having most kills/assists/heals/deaths in \gls{public matches}/\gls{ranked matches}/\gls{professional matches}?
\item What is the most purchased item in \gls{public matches}/\gls{ranked matches}/\gls{professional matches}?
\item Who is the hero having most bad-manner players (players who are \gls{AFK} or disconnected)?
\item Who is the most popular hero (the hero who has the highest pick rate) in \gls{public matches}/\gls{ranked matches}/\gls{professional matches}?
\item Who is the hero having the highest ban rate in \gls{professional matches}?
\item How long does a game cost on average in \gls{public matches}/\gls{ranked matches}/\gls{professional matches}?
\item Which item is used most in \gls{public matches}/\gls{ranked matches}/\gls{professional matches}?
\end{itemize}
We categorize these questions as easy questions because the solutions to them are straight-forward. These questions can be answered by implementing aggregation on our datasets. And most of the data needed for these questions can be extracted directly from our datasets.
\\
\item Moderately challenging questions:
\begin{itemize}
\item How are the benefits gained from \gls{buyback}s in \gls{public matches}/\gls{ranked matches}/\gls{professional matches}?
\item How is the vision in \gls{public matches}/\gls{ranked matches}/\gls{professional matches}?
\item When does the first team battle happen in \gls{public matches}/\gls{ranked matches}/\gls{professional matches}?
\item Which is lineup having the highest win rate in \gls{public matches}/\gls{ranked matches}/\gls{professional matches}?
\item Which is the most popular lineup (lineup which has the highest pick rate) in \gls{public matches}/\gls{ranked matches}/\gls{professional matches}?
\item Which is the most common ban-pick combo in \gls{public matches}/\gls{ranked matches}/\gls{professional matches}?
\item Who is the hero changed most in win/\gls{pick}/\gls{ban} rate after releasing a new version of Dota2?
\item Who is the hero having the highest winning rate in each \gls{lane}?
\end{itemize}
We categorize these questions as moderately challenging questions because the solutions to them are not that straight-forward as easy questions. The first challenge is to define some terms we used in these questions in the application code. For example, we use the term, vision, which is involved with the lifecycle of ward and sentry (two items provide visibility around them). Besides aggregation, we also need join operations to answer these questions.\\
\item Challenging questions:
\begin{itemize}
\item How is the winning-losing relationship between Dota2 professional teams? Can we use a graph to visualize it?
\item Does there exist a regular farming path for some professional players?
\item Does there exist a correlation between the time of the \gls{first-blood} and the time of the entire game?
\item Does there exist a correlation between the \gls{gold}/\gls{XP} source of a hero and its win rate?
\item Does there exist a correlation between the distribution of the economy and the result of the game?
\item Does there exist a correlation between economic development and the time of the first \gls{team battle}?
\end{itemize}
We categorize these questions as challenging questions because they need more techniques than moderately challenging questions. Like moderately challenging questions, they have some ambiguous definition needs to be implemented. But they cannot be answered easily by aggregation and join operations. Instead, we plan to use machine learning techniques to solve them.
\end{itemize}
\section{Data ETL}
\subsection{Extraction}
Valve, the company that develops the game, initially try to provide all the players with easy APIs to access the data of the game.
But due to the increasing stress on its data servers, many of its APIs are shut down.
At the same time, the documentation seems to be never updated since it's created, which makes it much more difficult for us to collect the data.
For example, the API which returns a bunch of the match results given a starting match id is not usable anymore.
Another API which returns a key that is critical for construct the URL to download replay of that game is not working as well.
But luckily, we found some hints from the \href{https://dev.dota2.com}{developer's forum of Dota2}.
We can use the starting \gls{sequence number}, which works similarly as the \gls{match id}, to get a series of game results.
And by calling a third party API from OpenDota, we can get the important key to constructing the URL to download replays again.
The specific steps of gaining our data are as following:
\begin{enumerate}
\item Match Results:
\begin{itemize}
\item Use \href{https://wiki.teamfortress.com/wiki/WebAPI/GetMatchHistoryBySequenceNum}{GetMatchHistoryBySequenceNum} API to get the match ids. We will need a a field called \\ \codeinline{start_at_match_seq_num} to specify the starting match sequence number of the results.
\item Then we can extract the last sequence number of the results as the \codeinline{start_at_match_seq_num} for the next call. By doing this iteratively we can enlarge our dataset for our first kind of data.
\end{itemize}
\item Replays:
\begin{itemize}
\item Get the match ids of recent professional games from the last step.
\item Use the those ids via \href{https://docs.opendota.com/#tag/matches}{OpenDota API} to get the information we need \\ (\codeinline{cluster} and \codeinline{replay_salt}) for retrieving replays from Valve's replay server
\item Construct links in this format:\\ \codeinline{ http://replay<cluster>.valve.net/570/<match_id>_<replay_salt>.dem.bz2} to get the replays.
\end{itemize}
\end{enumerate}
\subsection{Transformation}
The match result is in JSON format so we can almost directly store it. The information it contains is:
\begin{itemize}
\item Players information:
\begin{itemize}
\item Account id
\item Player slot
\item The hero he uses in this match
\item The items he possesses at the end of the match
\item The player's kills/deaths/assists
\item The player's leaver status (whether \gls{AFK}/disconnected or not)
\item The gold he possesses at the end of the match
\item The amount of \gls{last-hit}s and denies the player got during the match
\item The average \gls{gold}/\gls{XP} he gained per minute
\item The total gold he spent during the match
\item The amount of damage the player dealt to heroes/\gls{towers}
\item The amount of health the player had healed on heroes
\item The player's level at match end
\item A list detailing a player's ability upgrades, including the ability and the upgrading time
\item Additional playable units owned by the player and its items
\end{itemize}
\item The season the game was played in
\item The winner team of the match
\item The length of the match
\item Unix timestamp of when the match began
\item The matches unique ID
\item A sequence number, representing the order in which matches were recorded
\item The tower status of both teams
\item The \gls{barracks} status of both teams
\item The server cluster the match was played upon
\item The time in seconds since the match began when \gls{first-blood} occurred
\item The \gls{mode} of the match
\item The number of human players within the match
\item The league that this match was a part of
\item The number of thumbs-up/thumbs-down the game has received by users
\item A list of the picks and bans in the match, if the game \gls{mode} is Captains Mode
\end{itemize}
On the other hand, the replay data is completely unstructured \codeinline{.dem.bz2} binary file,
data transformation must be done before we can store the data in our database.
Firstly, we can decompress the \codeinline{.bz2} file with \codeinline{org.apache.commons.compress.compressors.bzip2} package in Java,
which will give us a \codeinline{.dem} file:
Next, we can utilize \href{https://github.com/skadistats/clarity}{clarity},
an open source Dota2 replay parser, to extract useful information from the \codeinline{.dem} file.
It cannot be achieved by a single click, though. We have to write a lot of code to invoke its function.
What's more, clarity does not provide detailed documentation, instead there are only some \href{https://github.com/skadistats/clarity-examples}{examples} which forces us to iteratively attempt and learn the usage of this tool.
Based on our exploration, the following data will be available:
\begin{itemize}
% info
\item Player name, id, team formation and hero choice
% combatlog
\item Detailed log of the game, including a hero:
\begin{itemize}
\item deals damage to another one
\item heals another one
\item receives/loses a \gls{buff}/\gls{debuff}
\item kills another one
\item uses his ability
\item uses an item
\item buys an item
\item receives/loses some \gls{gold}
\item gains some \gls{XP}
\item buys back (spending money in order to instantly re-spawn)
\end{itemize}
% lifestate
\item Spawn/death of heros and NPCs
\end{itemize}
These information will be organized in a Document and store to our database.
Most fields in our datasets are related to some of the above-mentioned business questions.
They are all important.
We will generally validate them, for example, fields like the HP, XP, total gold cannot be negative.
What's more important is to filter out invalid data on the game level. Some of the games lasts for only two or three minutes, because some players are disconnected and others just quit the game very quick. Others are practicing games where most players are computer bots. We will completely drop these game records.
% --------------------------------------------
% Except for those listed above:
% Run success but hard to find meaning:
% dump, dumpbaselines, dumpmana, gameevent, modifiers, particles
% propertychange, resources, seek, spawngroups, stringtabledump, tick
% Run failed: allchat, livesource, metadata, serializers,
% Unknown:
% - dtinspector: Seems to provide a GUI interface but I(LYF) run in docker, which raises an exception.
% - entityrun: No output
% - matchend: Produced result but also raises exception
% - tempentities: No output
% --------------------------------------------
\subsection{Loading}
\subsubsection{NoSQL Storage Technology}
As we mentioned above, we have two datasets - one is the match results data in JSON format, which is a kind of document that can be encoded using a text-based encoding scheme.
The replay data is binary files which is inappropriate for document NoSQL database to store.
But after we parsing those replay data, we can gather useful information from replay data in Document format.
Therefore, we choose to use MongoDB as our primary NoSQL storage technology.
MongoDB is a popular NoSQL storage device that can store high volume, high velocity, high variety Big Data datasets.
It's a document storage device, which makes storing semi-structured document-oriented data such as JSON much easier.
It is an open-source NoSQL database, so we are free to use it.
Also, MongoDB supports partial update.
This will help us aggregate values in future games that we would potentially use.
To answer the business question about the relationship between professional teams and players, using only MongoDB may involve considerable aggregations. We may consider using a graph database, neo4j, as our secondary NoSQL technology choice.
\subsubsection{Docker}
In order to combine different needs, programming languages and developing environment of many technologies, we will adopt Docker to our project.
Using Docker, we can deploy our application into any environment.
Docker is a container technology that provides consistency.
It's open-source and there are many open source applications that have been made in \href{https://hub.docker.com}{Docker Hub}.
Docker Hub provides official or verified images, so it's safe to use.
In our project, we will build Dockerfile to let it connect with our project.
We will use Scala as programming language, and we will get the match results data from Dota2's official API.
MongoDB will be used as database. And then we will put all of this into a Docker container.
\subsubsection{AWS (Amazon Web Service)}
As we mentioned before, we need 50GB to store the JSON file, and we need 180GB to store replay data, and the scale would be extended if we add more data in the datasets.
In order to have enough capacity to store datasets, we will use AWS (Amazon Web Server) to deploy our project on a cloud server.
Running Docker on AWS will provide us an open-source and free way to build and run a distributed application and provide a reliable and easy way to scale out.
AWS provides numbers of official ways to deploy docker on AWS, such as Amazon ECS, which is a highly scalable, high-performance container orchestration service to run Docker containers on the AWS cloud.
After we package datasets and analytics packages into Docker, we will deploy Docker to Amazon ECS.
%-------%
\section{Overview of our Architecture}
\begin{figure}[H]
\centering
\includegraphics[width=\linewidth]{pic/arc.png}
\caption{Our Project's Structure}
\end{figure}
\section{Potential Challenges}
There are several aspects where we may have potential challenges.
During the environment setup:
\begin{itemize}
\item We are trying to build a docker containerized application, but none of our team members have previous experience
\item We do not have experience about using AWS or other cloud services, neither
\end{itemize}
In the data ETL phase:
\begin{itemize}
\item Download replays from the server can be slow, the links may not work
\item Professional games are relatively rare, so more efforts will be needed to find and retrieve the professional replays
\item Both APIs have call limits, even though we can control our request frequency, some request may still fail
\item Some downloaded replay files may be broken so that no information can be extracted, or they may even cause exceptions in the pipeline
\item The open-source replay parser does not have documentation, thus some of our parsing code may cause unexpected exceptions when there are some corner case
\item Although we try our best to write the code to handle errors to avoid the program failing, but there still can be cases that are not covered, since our architecture involves a lot of network communications and i/o. We might need to design a log system to help us restore from a crash.
\end{itemize}
In the data analysis phase:
\begin{itemize}
\item Lots of joins and aggregations between the two datasets will be involved
\item We must quantitatively define some generally used concepts which are often qualitatively used, for example, the measurement of vision, team battle, etc. An inappropriate definition can make the whole conclusion meaningless
\item When we are answering the relationship between the teams or players, we will have to extract and load the data to a secondary database, like neo4j
\end{itemize}
\printglossary
%-------%
\end{document}
|
Much of the German policy on Polish culture was formulated during a meeting between the governor of the General Government , Hans Frank , and Nazi Minister of Propaganda Joseph Goebbels , at Łódź on 31 October 1939 . Goebbels declared that " The Polish nation is not worthy to be called a cultured nation " . He and Frank agreed that opportunities for the Poles to experience their culture should be severely restricted : no theaters , cinemas or cabarets ; no access to radio or press ; and no education . Frank suggested that the Poles should periodically be shown films highlighting the achievements of the Third Reich and should eventually be addressed only by megaphone . During the following weeks Polish schools beyond middle vocational levels were closed , as were theaters and many other cultural institutions . The only Polish @-@ language newspaper published in occupied Poland was also closed , and the arrests of Polish intellectuals began .
|
[STATEMENT]
lemma bit_sshiftr1_iff [bit_simps]:
\<open>bit (sshiftr1 w) n \<longleftrightarrow> bit w (if n = LENGTH('a) - 1 then LENGTH('a) - 1 else Suc n)\<close>
for w :: \<open>'a::len word\<close>
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. bit (sshiftr1 w) n = bit w (if n = LENGTH('a) - 1 then LENGTH('a) - 1 else Suc n)
[PROOF STEP]
by (auto simp add: sshiftr1_def bit_signed_drop_bit_iff) |
/-
Copyright (c) 2023 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen
! This file was ported from Lean 3 source module ring_theory.dedekind_domain.pid
! leanprover-community/mathlib commit 6010cf523816335f7bae7f8584cb2edaace73940
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathbin.RingTheory.DedekindDomain.Dvr
import Mathbin.RingTheory.DedekindDomain.Ideal
/-!
# Proving a Dedekind domain is a PID
This file contains some results that we can use to show all ideals in a Dedekind domain are
principal.
## Main results
* `ideal.is_principal.of_finite_maximals_of_is_unit`: an invertible ideal in a commutative ring
with finitely many maximal ideals, is a principal ideal.
* `is_principal_ideal_ring.of_finite_primes`: if a Dedekind domain has finitely many prime ideals,
it is a principal ideal domain.
-/
variable {R : Type _} [CommRing R]
open Ideal
open UniqueFactorizationMonoid
open BigOperators
open nonZeroDivisors
open UniqueFactorizationMonoid
/-- Let `P` be a prime ideal, `x ∈ P \ P²` and `x ∉ Q` for all prime ideals `Q ≠ P`.
Then `P` is generated by `x`. -/
theorem Ideal.eq_span_singleton_of_mem_of_not_mem_sq_of_not_mem_prime_ne {P : Ideal R}
(hP : P.IsPrime) [IsDomain R] [IsDedekindDomain R] {x : R} (x_mem : x ∈ P) (hxP2 : x ∉ P ^ 2)
(hxQ : ∀ Q : Ideal R, IsPrime Q → Q ≠ P → x ∉ Q) : P = Ideal.span {x} :=
by
letI := Classical.decEq (Ideal R)
have hx0 : x ≠ 0 := by
rintro rfl
exact hxP2 (zero_mem _)
by_cases hP0 : P = ⊥
· subst hP0
simpa using hxP2
have hspan0 : span ({x} : Set R) ≠ ⊥ := mt ideal.span_singleton_eq_bot.mp hx0
have span_le := (Ideal.span_singleton_le_iff_mem _).mpr x_mem
refine'
associated_iff_eq.mp
((associated_iff_normalized_factors_eq_normalized_factors hP0 hspan0).mpr
(le_antisymm ((dvd_iff_normalized_factors_le_normalized_factors hP0 hspan0).mp _) _))
· rwa [Ideal.dvd_iff_le, Ideal.span_singleton_le_iff_mem]
simp only [normalized_factors_irreducible (Ideal.prime_of_isPrime hP0 hP).Irreducible,
normalize_eq, Multiset.le_iff_count, Multiset.count_singleton]
intro Q
split_ifs with hQ
· subst hQ
refine' (Ideal.count_normalizedFactors_eq _ _).le <;>
simp only [Ideal.span_singleton_le_iff_mem, pow_one] <;>
assumption
by_cases hQp : is_prime Q
· skip
refine' (Ideal.count_normalizedFactors_eq _ _).le <;>
simp only [Ideal.span_singleton_le_iff_mem, pow_one, pow_zero, one_eq_top, Submodule.mem_top]
exact hxQ _ hQp hQ
·
exact
(multiset.count_eq_zero.mpr fun hQi =>
hQp
(is_prime_of_prime
(irreducible_iff_prime.mp (irreducible_of_normalized_factor _ hQi)))).le
#align ideal.eq_span_singleton_of_mem_of_not_mem_sq_of_not_mem_prime_ne Ideal.eq_span_singleton_of_mem_of_not_mem_sq_of_not_mem_prime_ne
theorem FractionalIdeal.isPrincipal_of_unit_of_comap_mul_span_singleton_eq_top {R A : Type _}
[CommRing R] [CommRing A] [Algebra R A] {S : Submonoid R} [IsLocalization S A]
(I : (FractionalIdeal S A)ˣ) {v : A} (hv : v ∈ (↑I⁻¹ : FractionalIdeal S A))
(h : Submodule.comap (Algebra.linearMap R A) (I * Submodule.span R {v}) = ⊤) :
Submodule.IsPrincipal (I : Submodule R A) :=
by
have hinv := I.mul_inv
set J := Submodule.comap (Algebra.linearMap R A) (I * Submodule.span R {v})
have hJ : IsLocalization.coeSubmodule A J = I * Submodule.span R {v} :=
by
rw [Subtype.ext_iff, FractionalIdeal.coe_mul, FractionalIdeal.coe_one] at hinv
apply Submodule.map_comap_eq_self
rw [← Submodule.one_eq_range, ← hinv]
exact Submodule.mul_le_mul_right ((Submodule.span_singleton_le_iff_mem _ _).2 hv)
have : (1 : A) ∈ ↑I * Submodule.span R {v} :=
by
rw [← hJ, h, IsLocalization.coeSubmodule_top, Submodule.mem_one]
exact ⟨1, (algebraMap R _).map_one⟩
obtain ⟨w, hw, hvw⟩ := Submodule.mem_mul_span_singleton.1 this
refine' ⟨⟨w, _⟩⟩
rw [← FractionalIdeal.coe_spanSingleton S, ← inv_inv I, eq_comm, coe_coe]
refine' congr_arg coe (Units.eq_inv_of_mul_eq_one_left (le_antisymm _ _))
· infer_instance
· conv_rhs => rw [← hinv, mul_comm]
apply FractionalIdeal.mul_le_mul_left (fractional_ideal.span_singleton_le_iff_mem.mpr hw)
· rw [FractionalIdeal.one_le, ← hvw, mul_comm]
exact FractionalIdeal.mul_mem_mul hv (FractionalIdeal.mem_spanSingleton_self _ _)
#align fractional_ideal.is_principal_of_unit_of_comap_mul_span_singleton_eq_top FractionalIdeal.isPrincipal_of_unit_of_comap_mul_span_singleton_eq_top
/--
An invertible fractional ideal of a commutative ring with finitely many maximal ideals is principal.
https://math.stackexchange.com/a/95857 -/
theorem FractionalIdeal.isPrincipal.of_finite_maximals_of_inv {A : Type _} [CommRing A]
[Algebra R A] {S : Submonoid R} [IsLocalization S A] (hS : S ≤ R⁰)
(hf : { I : Ideal R | I.IsMaximal }.Finite) (I I' : FractionalIdeal S A) (hinv : I * I' = 1) :
Submodule.IsPrincipal (I : Submodule R A) :=
by
have hinv' := hinv
rw [Subtype.ext_iff, FractionalIdeal.coe_mul] at hinv
let s := hf.to_finset
haveI := Classical.decEq (Ideal R)
have coprime : ∀ M ∈ s, ∀ M' ∈ s.erase M, M ⊔ M' = ⊤ :=
by
simp_rw [Finset.mem_erase, hf.mem_to_finset]
rintro M hM M' ⟨hne, hM'⟩
exact Ideal.IsMaximal.coprime_of_ne hM hM' hne.symm
have nle : ∀ M ∈ s, ¬(⨅ M' ∈ s.erase M, M') ≤ M := fun M hM =>
left_lt_sup.1
((hf.mem_to_finset.1 hM).ne_top.lt_top.trans_eq (Ideal.sup_infᵢ_eq_top <| coprime M hM).symm)
have : ∀ M ∈ s, ∃ a ∈ I, ∃ b ∈ I', a * b ∉ IsLocalization.coeSubmodule A M :=
by
intro M hM
by_contra' h
obtain ⟨x, hx, hxM⟩ :=
SetLike.exists_of_lt
((IsLocalization.coeSubmodule_strictMono hS (hf.mem_to_finset.1 hM).ne_top.lt_top).trans_eq
hinv.symm)
refine' hxM (Submodule.map₂_le.2 _ hx)
exact h
choose! a ha b hb hm using this
choose! u hu hum using fun M hM => SetLike.not_le_iff_exists.1 (nle M hM)
let v := ∑ M in s, u M • b M
have hv : v ∈ I' := Submodule.sum_mem _ fun M hM => Submodule.smul_mem _ _ <| hb M hM
refine'
FractionalIdeal.isPrincipal_of_unit_of_comap_mul_span_singleton_eq_top
(Units.mkOfMulEqOne I I' hinv') hv (of_not_not fun h => _)
obtain ⟨M, hM, hJM⟩ := Ideal.exists_le_maximal _ h
replace hM := hf.mem_to_finset.2 hM
have : ∀ a ∈ I, ∀ b ∈ I', ∃ c, algebraMap R _ c = a * b :=
by
intro a ha b hb
have hi := hinv.le
obtain ⟨c, -, hc⟩ := hi (Submodule.mul_mem_mul ha hb)
exact ⟨c, hc⟩
have hmem : a M * v ∈ IsLocalization.coeSubmodule A M :=
by
obtain ⟨c, hc⟩ := this _ (ha M hM) v hv
refine' IsLocalization.coeSubmodule_mono _ hJM ⟨c, _, hc⟩
have := Submodule.mul_mem_mul (ha M hM) (Submodule.mem_span_singleton_self v)
rwa [← hc] at this
simp_rw [Finset.mul_sum, mul_smul_comm] at hmem
rw [← s.add_sum_erase _ hM, Submodule.add_mem_iff_left] at hmem
· refine' hm M hM _
obtain ⟨c, hc : algebraMap R A c = a M * b M⟩ := this _ (ha M hM) _ (hb M hM)
rw [← hc] at hmem⊢
rw [Algebra.smul_def, ← _root_.map_mul] at hmem
obtain ⟨d, hdM, he⟩ := hmem
rw [IsLocalization.injective _ hS he] at hdM
exact
Submodule.mem_map_of_mem
(((hf.mem_to_finset.1 hM).IsPrime.mem_or_mem hdM).resolve_left <| hum M hM)
· refine' Submodule.sum_mem _ fun M' hM' => _
rw [Finset.mem_erase] at hM'
obtain ⟨c, hc⟩ := this _ (ha M hM) _ (hb M' hM'.2)
rw [← hc, Algebra.smul_def, ← _root_.map_mul]
specialize hu M' hM'.2
simp_rw [Ideal.mem_infᵢ, Finset.mem_erase] at hu
exact Submodule.mem_map_of_mem (M.mul_mem_right _ <| hu M ⟨hM'.1.symm, hM⟩)
#align fractional_ideal.is_principal.of_finite_maximals_of_inv FractionalIdeal.isPrincipal.of_finite_maximals_of_inv
/-- An invertible ideal in a commutative ring with finitely many maximal ideals is principal.
https://math.stackexchange.com/a/95857 -/
theorem Ideal.IsPrincipal.of_finite_maximals_of_isUnit (hf : { I : Ideal R | I.IsMaximal }.Finite)
{I : Ideal R} (hI : IsUnit (I : FractionalIdeal R⁰ (FractionRing R))) : I.IsPrincipal :=
(IsLocalization.coeSubmodule_isPrincipal _ le_rfl).mp
(FractionalIdeal.isPrincipal.of_finite_maximals_of_inv le_rfl hf I
(↑hI.Unit⁻¹ : FractionalIdeal R⁰ (FractionRing R)) hI.Unit.mul_inv)
#align ideal.is_principal.of_finite_maximals_of_is_unit Ideal.IsPrincipal.of_finite_maximals_of_isUnit
/-- A Dedekind domain is a PID if its set of primes is finite. -/
theorem IsPrincipalIdealRing.of_finite_primes [IsDomain R] [IsDedekindDomain R]
(h : { I : Ideal R | I.IsPrime }.Finite) : IsPrincipalIdealRing R :=
⟨fun I => by
obtain rfl | hI := eq_or_ne I ⊥
· exact bot_isPrincipal
apply Ideal.IsPrincipal.of_finite_maximals_of_isUnit
· apply h.subset
exact @Ideal.IsMaximal.isPrime _ _
· exact isUnit_of_mul_eq_one _ _ (FractionalIdeal.coe_ideal_mul_inv I hI)⟩
#align is_principal_ideal_ring.of_finite_primes IsPrincipalIdealRing.of_finite_primes
variable [IsDomain R] [IsDedekindDomain R]
variable (S : Type _) [CommRing S] [IsDomain S]
variable [Algebra R S] [Module.Free R S] [Module.Finite R S]
variable (p : Ideal R) (hp0 : p ≠ ⊥) [IsPrime p]
variable {Sₚ : Type _} [CommRing Sₚ] [Algebra S Sₚ]
variable [IsLocalization (Algebra.algebraMapSubmonoid S p.primeCompl) Sₚ]
variable [Algebra R Sₚ] [IsScalarTower R S Sₚ]
/- The first hypothesis below follows from properties of the localization but is needed for the
second, so we leave it to the user to provide (automatically). -/
variable [IsDomain Sₚ] [IsDedekindDomain Sₚ]
include S hp0
/-- If `p` is a prime in the Dedekind domain `R`, `S` an extension of `R` and `Sₚ` the localization
of `S` at `p`, then all primes in `Sₚ` are factors of the image of `p` in `Sₚ`. -/
theorem IsLocalization.OverPrime.mem_normalizedFactors_of_isPrime [DecidableEq (Ideal Sₚ)]
{P : Ideal Sₚ} (hP : IsPrime P) (hP0 : P ≠ ⊥) :
P ∈ normalizedFactors (Ideal.map (algebraMap R Sₚ) p) :=
by
have non_zero_div : Algebra.algebraMapSubmonoid S p.prime_compl ≤ S⁰ :=
map_le_nonZeroDivisors_of_injective _ (NoZeroSMulDivisors.algebraMap_injective _ _)
p.prime_compl_le_non_zero_divisors
letI : Algebra (Localization.AtPrime p) Sₚ := localizationAlgebra p.prime_compl S
haveI : IsScalarTower R (Localization.AtPrime p) Sₚ :=
IsScalarTower.of_algebraMap_eq fun x => by
erw [IsLocalization.map_eq, IsScalarTower.algebraMap_apply R S]
obtain ⟨pid, p', ⟨hp'0, hp'p⟩, hpu⟩ :=
(DiscreteValuationRing.iff_pid_with_one_nonzero_prime (Localization.AtPrime p)).mp
(IsLocalization.AtPrime.discreteValuationRing_of_dedekind_domain R hp0 _)
have : LocalRing.maximalIdeal (Localization.AtPrime p) ≠ ⊥ :=
by
rw [Submodule.ne_bot_iff] at hp0⊢
obtain ⟨x, x_mem, x_ne⟩ := hp0
exact
⟨algebraMap _ _ x, (IsLocalization.AtPrime.to_map_mem_maximal_iff _ _ _).mpr x_mem,
IsLocalization.to_map_ne_zero_of_mem_nonZeroDivisors _ p.prime_compl_le_non_zero_divisors
(mem_nonZeroDivisors_of_ne_zero x_ne)⟩
rw [← Multiset.singleton_le, ← normalize_eq P, ←
normalized_factors_irreducible (Ideal.prime_of_isPrime hP0 hP).Irreducible, ←
dvd_iff_normalized_factors_le_normalized_factors hP0, dvd_iff_le,
IsScalarTower.algebraMap_eq R (Localization.AtPrime p) Sₚ, ← Ideal.map_map,
Localization.AtPrime.map_eq_maximalIdeal, Ideal.map_le_iff_le_comap,
hpu (LocalRing.maximalIdeal _) ⟨this, _⟩, hpu (comap _ _) ⟨_, _⟩]
· exact le_rfl
· have hRS : Algebra.IsIntegral R S :=
isIntegral_of_noetherian (isNoetherian_of_fg_of_noetherian' Module.Finite.out)
exact mt (Ideal.eq_bot_of_comap_eq_bot (isIntegral_localization hRS)) hP0
· exact Ideal.comap_isPrime (algebraMap (Localization.AtPrime p) Sₚ) P
· exact (LocalRing.maximalIdeal.isMaximal _).IsPrime
· rw [Ne.def, zero_eq_bot, Ideal.map_eq_bot_iff_of_injective]
· assumption
rw [IsScalarTower.algebraMap_eq R S Sₚ]
exact
(IsLocalization.injective Sₚ non_zero_div).comp (NoZeroSMulDivisors.algebraMap_injective _ _)
#align is_localization.over_prime.mem_normalized_factors_of_is_prime IsLocalization.OverPrime.mem_normalizedFactors_of_isPrime
/-- Let `p` be a prime in the Dedekind domain `R` and `S` be an integral extension of `R`,
then the localization `Sₚ` of `S` at `p` is a PID. -/
theorem IsDedekindDomain.isPrincipalIdealRing_localization_over_prime : IsPrincipalIdealRing Sₚ :=
by
letI := Classical.decEq (Ideal Sₚ)
letI := Classical.decPred fun P : Ideal Sₚ => P.IsPrime
refine'
IsPrincipalIdealRing.of_finite_primes
(Set.Finite.ofFinset
(Finset.filter (fun P => P.IsPrime)
({⊥} ∪ (normalized_factors (Ideal.map (algebraMap R Sₚ) p)).toFinset))
fun P => _)
rw [Finset.mem_filter, Finset.mem_union, Finset.mem_singleton, Set.mem_setOf,
Multiset.mem_toFinset]
exact
and_iff_right_of_imp fun hP =>
or_iff_not_imp_left.mpr (IsLocalization.OverPrime.mem_normalizedFactors_of_isPrime S p hp0 hP)
#align is_dedekind_domain.is_principal_ideal_ring_localization_over_prime IsDedekindDomain.isPrincipalIdealRing_localization_over_prime
|
On June 7 , 1911 , Madero entered Mexico City . In October 1911 he was elected president , under the banner of the Partido <unk> <unk> , along with José María Pino Suárez , his new running mate as vice @-@ president . Madero pushed aside Francisco Vázquez Gómez , the vice presidential candidate for the Anti @-@ <unk> Party in 1910 , as being too moderate .
|
[STATEMENT]
lemma le_inf_eq_inf_transp[intro, trans]:
assumes "w\<^sub>1 \<preceq>\<^sub>I w\<^sub>2" "w\<^sub>2 =\<^sub>I w\<^sub>3"
shows "w\<^sub>1 \<preceq>\<^sub>I w\<^sub>3"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. w\<^sub>1 \<preceq>\<^sub>I w\<^sub>3
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
w\<^sub>1 \<preceq>\<^sub>I w\<^sub>2
w\<^sub>2 =\<^sub>I w\<^sub>3
goal (1 subgoal):
1. w\<^sub>1 \<preceq>\<^sub>I w\<^sub>3
[PROOF STEP]
by blast |
function display(obj)
% Display a NIFTI-1 object
% _______________________________________________________________________
% Copyright (C) 2008 Wellcome Trust Centre for Neuroimaging
%
% $Id$
disp(' ');
disp([inputname(1),' = '])
disp(' ');
disp(obj)
disp(' ')
|
[STATEMENT]
lemma gcd_pos_int [simp]: "gcd m n > 0 \<longleftrightarrow> m \<noteq> 0 \<or> n \<noteq> 0"
for m n :: int
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. (0 < gcd m n) = (m \<noteq> 0 \<or> n \<noteq> 0)
[PROOF STEP]
using gcd_eq_0_iff [of m n] gcd_ge_0_int [of m n]
[PROOF STATE]
proof (prove)
using this:
(gcd m n = 0) = (m = 0 \<and> n = 0)
0 \<le> gcd m n
goal (1 subgoal):
1. (0 < gcd m n) = (m \<noteq> 0 \<or> n \<noteq> 0)
[PROOF STEP]
by arith |
[STATEMENT]
lemma finfun_All_except_update_code [code]:
fixes a :: "'a :: card_UNIV"
shows "finfun_All_except A (finfun_update_code f a b) = ((a \<in> set A \<or> b) \<and> finfun_All_except (a # A) f)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. finfun_All_except A (finfun_update_code f a b) = ((a \<in> set A \<or> b) \<and> finfun_All_except (a # A) f)
[PROOF STEP]
by(simp add: finfun_All_except_update) |
[STATEMENT]
lemma memory_write_low_equal_none: "low_equal s1 s2 \<Longrightarrow>
memory_write 10 addr bm data s1 = None \<Longrightarrow>
memory_write 10 addr bm data s2 = None"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>low_equal s1 s2; memory_write 10 addr bm data s1 = None\<rbrakk> \<Longrightarrow> memory_write 10 addr bm data s2 = None
[PROOF STEP]
apply (simp add: memory_write_def)
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lbrakk>low_equal s1 s2; (case memory_write_asi 10 addr bm data s1 of None \<Rightarrow> None | Some s1 \<Rightarrow> Some (store_barrier_pending_mod False s1)) = None\<rbrakk> \<Longrightarrow> (case memory_write_asi 10 addr bm data s2 of None \<Rightarrow> None | Some s1 \<Rightarrow> Some (store_barrier_pending_mod False s1)) = None
[PROOF STEP]
by (metis map_option_case memory_write_asi_low_equal_none option.map_disc_iff) |
State Before: K : Type u
V : Type v
inst✝⁶ : Ring K
inst✝⁵ : AddCommGroup V
inst✝⁴ : Module K V
V₂ : Type v'
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : Nontrivial K
inst✝ : NoZeroSMulDivisors K V
h : Subsingleton V
⊢ finrank K V = 0 State After: K : Type u
V : Type v
inst✝⁶ : Ring K
inst✝⁵ : AddCommGroup V
inst✝⁴ : Module K V
V₂ : Type v'
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : Nontrivial K
inst✝ : NoZeroSMulDivisors K V
h : Subsingleton V
h0 : ¬finrank K V = 0
⊢ False Tactic: by_contra h0 State Before: K : Type u
V : Type v
inst✝⁶ : Ring K
inst✝⁵ : AddCommGroup V
inst✝⁴ : Module K V
V₂ : Type v'
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : Nontrivial K
inst✝ : NoZeroSMulDivisors K V
h : Subsingleton V
h0 : ¬finrank K V = 0
⊢ False State After: case mk.intro.intro
K : Type u
V : Type v
inst✝⁶ : Ring K
inst✝⁵ : AddCommGroup V
inst✝⁴ : Module K V
V₂ : Type v'
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : Nontrivial K
inst✝ : NoZeroSMulDivisors K V
h : Subsingleton V
h0 : ¬finrank K V = 0
x y : V
hxy : x ≠ y
⊢ False Tactic: obtain ⟨x, y, hxy⟩ := nontrivial_of_finrank_pos (Nat.pos_of_ne_zero h0) State Before: case mk.intro.intro
K : Type u
V : Type v
inst✝⁶ : Ring K
inst✝⁵ : AddCommGroup V
inst✝⁴ : Module K V
V₂ : Type v'
inst✝³ : AddCommGroup V₂
inst✝² : Module K V₂
inst✝¹ : Nontrivial K
inst✝ : NoZeroSMulDivisors K V
h : Subsingleton V
h0 : ¬finrank K V = 0
x y : V
hxy : x ≠ y
⊢ False State After: no goals Tactic: exact hxy (Subsingleton.elim _ _) |
[STATEMENT]
lemma List_cons [simp]: "List p h (a#ps) = (p = a \<and> p\<noteq>Null \<and> List (h p) h ps)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. List p h (a # ps) = (p = a \<and> p \<noteq> Null \<and> List (h p) h ps)
[PROOF STEP]
by(simp add:List_def) |
[GOAL]
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Monoid G
n : ℕ
A : Rep k G
f g : (Fin n → G) → CoeSort.coe A
⊢ (fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
(f + g) =
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
f +
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
g
[PROOFSTEP]
ext x
[GOAL]
case h
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Monoid G
n : ℕ
A : Rep k G
f g : (Fin n → G) → CoeSort.coe A
x : Fin (n + 1) → G
⊢ (fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
(f + g) x =
((fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
f +
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
g)
x
[PROOFSTEP]
simp_rw [Pi.add_apply, map_add, smul_add, Finset.sum_add_distrib, add_add_add_comm]
[GOAL]
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Monoid G
n : ℕ
A : Rep k G
r : k
f : (Fin n → G) → CoeSort.coe A
⊢ AddHom.toFun
{
toFun := fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g),
map_add' :=
(_ :
∀ (f g : (Fin n → G) → CoeSort.coe A),
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
(f + g) =
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j =>
(-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
f +
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j =>
(-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
g) }
(r • f) =
↑(RingHom.id k) r •
AddHom.toFun
{
toFun := fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g),
map_add' :=
(_ :
∀ (f g : (Fin n → G) → CoeSort.coe A),
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j =>
(-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
(f + g) =
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j =>
(-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
f +
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j =>
(-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
g) }
f
[PROOFSTEP]
ext x
[GOAL]
case h
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Monoid G
n : ℕ
A : Rep k G
r : k
f : (Fin n → G) → CoeSort.coe A
x : Fin (n + 1) → G
⊢ AddHom.toFun
{
toFun := fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g),
map_add' :=
(_ :
∀ (f g : (Fin n → G) → CoeSort.coe A),
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
(f + g) =
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j =>
(-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
f +
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j =>
(-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
g) }
(r • f) x =
(↑(RingHom.id k) r •
AddHom.toFun
{
toFun := fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g),
map_add' :=
(_ :
∀ (f g : (Fin n → G) → CoeSort.coe A),
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j =>
(-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
(f + g) =
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j =>
(-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
f +
(fun f g =>
↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j =>
(-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g))
g) }
f)
x
[PROOFSTEP]
simp_rw [Pi.smul_apply, RingHom.id_apply, map_smul, smul_add, Finset.smul_sum, ← smul_assoc, smul_eq_mul, mul_comm r]
[GOAL]
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
⊢ d n A =
(LinearEquiv.toModuleIso (diagonalHomEquiv n A)).inv ≫
HomologicalComplex.d (linearYonedaObjResolution A) n (n + 1) ≫
(LinearEquiv.toModuleIso (diagonalHomEquiv (n + 1) A)).hom
[PROOFSTEP]
ext f g
[GOAL]
case h.h
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
f : (Fin n → G) → CoeSort.coe A
g : Fin (n + 1) → G
⊢ ↑(d n A) f g =
↑((LinearEquiv.toModuleIso (diagonalHomEquiv n A)).inv ≫
HomologicalComplex.d (linearYonedaObjResolution A) n (n + 1) ≫
(LinearEquiv.toModuleIso (diagonalHomEquiv (n + 1) A)).hom)
f g
[PROOFSTEP]
change d n A f g = diagonalHomEquiv (n + 1) A ((resolution k G).d (n + 1) n ≫ (diagonalHomEquiv n A).symm f) g
[GOAL]
case h.h
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
f : (Fin n → G) → CoeSort.coe A
g : Fin (n + 1) → G
⊢ ↑(d n A) f g =
↑(diagonalHomEquiv (n + 1) A)
(HomologicalComplex.d (resolution k G) (n + 1) n ≫ ↑(LinearEquiv.symm (diagonalHomEquiv n A)) f) g
[PROOFSTEP]
rw [diagonalHomEquiv_apply, Action.comp_hom, ModuleCat.comp_def, LinearMap.comp_apply, Resolution.d_eq]
[GOAL]
case h.h
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
f : (Fin n → G) → CoeSort.coe A
g : Fin (n + 1) → G
⊢ ↑(d n A) f g =
↑(↑(LinearEquiv.symm (diagonalHomEquiv n A)) f).hom
(↑(Resolution.d k G (n + 1)) (Finsupp.single (Fin.partialProd g) 1))
[PROOFSTEP]
erw [Resolution.d_of (Fin.partialProd g)]
[GOAL]
case h.h
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
f : (Fin n → G) → CoeSort.coe A
g : Fin (n + 1) → G
⊢ ↑(d n A) f g =
↑(↑(LinearEquiv.symm (diagonalHomEquiv n A)) f).hom
(Finset.sum Finset.univ fun p => Finsupp.single (Fin.partialProd g ∘ Fin.succAbove p) ((-1) ^ ↑p))
[PROOFSTEP]
rw [LinearMap.map_sum]
[GOAL]
case h.h
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
f : (Fin n → G) → CoeSort.coe A
g : Fin (n + 1) → G
⊢ ↑(d n A) f g =
Finset.sum Finset.univ fun i =>
↑(↑(LinearEquiv.symm (diagonalHomEquiv n A)) f).hom
(Finsupp.single (Fin.partialProd g ∘ Fin.succAbove i) ((-1) ^ ↑i))
[PROOFSTEP]
simp only [← Finsupp.smul_single_one _ ((-1 : k) ^ _)]
[GOAL]
case h.h
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
f : (Fin n → G) → CoeSort.coe A
g : Fin (n + 1) → G
⊢ ↑(d n A) f g =
Finset.sum Finset.univ fun x =>
↑(↑(LinearEquiv.symm (diagonalHomEquiv n A)) f).hom
((-1) ^ ↑x • Finsupp.single (Fin.partialProd g ∘ Fin.succAbove x) 1)
[PROOFSTEP]
rw [d_apply, @Fin.sum_univ_succ _ _ (n + 1), Fin.val_zero, pow_zero, one_smul, Fin.succAbove_zero,
diagonalHomEquiv_symm_apply f (Fin.partialProd g ∘ @Fin.succ (n + 1))]
[GOAL]
case h.h
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
f : (Fin n → G) → CoeSort.coe A
g : Fin (n + 1) → G
⊢ (↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g)) =
↑(↑(ρ A) ((Fin.partialProd g ∘ Fin.succ) 0))
(f fun i => ((Fin.partialProd g ∘ Fin.succ) (Fin.castSucc i))⁻¹ * (Fin.partialProd g ∘ Fin.succ) (Fin.succ i)) +
Finset.sum Finset.univ fun i =>
↑(↑(LinearEquiv.symm (diagonalHomEquiv n A)) f).hom
((-1) ^ ↑(Fin.succ i) • Finsupp.single (Fin.partialProd g ∘ Fin.succAbove (Fin.succ i)) 1)
[PROOFSTEP]
simp_rw [Function.comp_apply, Fin.partialProd_succ, Fin.castSucc_zero, Fin.partialProd_zero, one_mul]
[GOAL]
case h.h
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
f : (Fin n → G) → CoeSort.coe A
g : Fin (n + 1) → G
⊢ (↑(↑(ρ A) (g 0)) (f fun i => g (Fin.succ i)) +
Finset.sum Finset.univ fun j => (-1) ^ (↑j + 1) • f (Fin.contractNth j (fun x x_1 => x * x_1) g)) =
↑(↑(ρ A) (g 0))
(f fun i =>
(Fin.partialProd g (Fin.castSucc (Fin.castSucc i)) * g (Fin.castSucc i))⁻¹ *
(Fin.partialProd g (Fin.castSucc (Fin.succ i)) * g (Fin.succ i))) +
Finset.sum Finset.univ fun i =>
↑(↑(LinearEquiv.symm (diagonalHomEquiv n A)) f).hom
((-1) ^ ↑(Fin.succ i) • Finsupp.single (Fin.partialProd g ∘ Fin.succAbove (Fin.succ i)) 1)
[PROOFSTEP]
rcongr x
[GOAL]
case h.h.e_a.h.e_6.h.e_a.h
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
f : (Fin n → G) → CoeSort.coe A
g : Fin (n + 1) → G
x : Fin n
⊢ g (Fin.succ x) =
(Fin.partialProd g (Fin.castSucc (Fin.castSucc x)) * g (Fin.castSucc x))⁻¹ *
(Fin.partialProd g (Fin.castSucc (Fin.succ x)) * g (Fin.succ x))
[PROOFSTEP]
have := Fin.partialProd_right_inv g (Fin.castSucc x)
[GOAL]
case h.h.e_a.h.e_6.h.e_a.h
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
f : (Fin n → G) → CoeSort.coe A
g : Fin (n + 1) → G
x : Fin n
this :
(Fin.partialProd g (Fin.castSucc (Fin.castSucc x)))⁻¹ * Fin.partialProd g (Fin.succ (Fin.castSucc x)) =
g (Fin.castSucc x)
⊢ g (Fin.succ x) =
(Fin.partialProd g (Fin.castSucc (Fin.castSucc x)) * g (Fin.castSucc x))⁻¹ *
(Fin.partialProd g (Fin.castSucc (Fin.succ x)) * g (Fin.succ x))
[PROOFSTEP]
simp only [mul_inv_rev, Fin.castSucc_fin_succ] at this ⊢
[GOAL]
case h.h.e_a.h.e_6.h.e_a.h
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
f : (Fin n → G) → CoeSort.coe A
g : Fin (n + 1) → G
x : Fin n
this :
(Fin.partialProd g (Fin.castSucc (Fin.castSucc x)))⁻¹ * Fin.partialProd g (Fin.succ (Fin.castSucc x)) =
g (Fin.castSucc x)
⊢ g (Fin.succ x) =
(g (Fin.castSucc x))⁻¹ * (Fin.partialProd g (Fin.castSucc (Fin.castSucc x)))⁻¹ *
(Fin.partialProd g (Fin.succ (Fin.castSucc x)) * g (Fin.succ x))
[PROOFSTEP]
rw [mul_assoc, ← mul_assoc _ _ (g x.succ), this, inv_mul_cancel_left]
[GOAL]
case h.h.e_a.e_f.h
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
f : (Fin n → G) → CoeSort.coe A
g : Fin (n + 1) → G
x : Fin (n + 1)
⊢ (-1) ^ (↑x + 1) • f (Fin.contractNth x (fun x x_1 => x * x_1) g) =
↑(↑(LinearEquiv.symm (diagonalHomEquiv n A)) f).hom
((-1) ^ ↑(Fin.succ x) • Finsupp.single (Fin.partialProd g ∘ Fin.succAbove (Fin.succ x)) 1)
[PROOFSTEP]
rw [map_smul, diagonalHomEquiv_symm_partialProd_succ, Fin.val_succ]
[GOAL]
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Group G
A : Rep k G
n : ℕ
⊢ (fun n => d n A) n ≫ (fun n => d n A) (n + 1) = 0
[PROOFSTEP]
ext x
[GOAL]
case h
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Group G
A : Rep k G
n : ℕ
x : ↑((fun n => ModuleCat.of k ((Fin n → G) → CoeSort.coe A)) n)
⊢ ↑((fun n => d n A) n ≫ (fun n => d n A) (n + 1)) x = ↑0 x
[PROOFSTEP]
have := LinearMap.ext_iff.1 ((linearYonedaObjResolution A).d_comp_d n (n + 1) (n + 2))
[GOAL]
case h
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Group G
A : Rep k G
n : ℕ
x : ↑((fun n => ModuleCat.of k ((Fin n → G) → CoeSort.coe A)) n)
this :
∀ (x : ↑(HomologicalComplex.X (linearYonedaObjResolution A) n)),
↑(HomologicalComplex.d (linearYonedaObjResolution A) n (n + 1) ≫
HomologicalComplex.d (linearYonedaObjResolution A) (n + 1) (n + 2))
x =
↑0 x
⊢ ↑((fun n => d n A) n ≫ (fun n => d n A) (n + 1)) x = ↑0 x
[PROOFSTEP]
simp only [ModuleCat.comp_def, LinearMap.comp_apply] at this
[GOAL]
case h
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Group G
A : Rep k G
n : ℕ
x : ↑((fun n => ModuleCat.of k ((Fin n → G) → CoeSort.coe A)) n)
this :
∀ (x : ↑(HomologicalComplex.X (linearYonedaObjResolution A) n)),
↑(HomologicalComplex.d (linearYonedaObjResolution A) (n + 1) (n + 2))
(↑(HomologicalComplex.d (linearYonedaObjResolution A) n (n + 1)) x) =
↑0 x
⊢ ↑((fun n => d n A) n ≫ (fun n => d n A) (n + 1)) x = ↑0 x
[PROOFSTEP]
dsimp only
[GOAL]
case h
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Group G
A : Rep k G
n : ℕ
x : ↑((fun n => ModuleCat.of k ((Fin n → G) → CoeSort.coe A)) n)
this :
∀ (x : ↑(HomologicalComplex.X (linearYonedaObjResolution A) n)),
↑(HomologicalComplex.d (linearYonedaObjResolution A) (n + 1) (n + 2))
(↑(HomologicalComplex.d (linearYonedaObjResolution A) n (n + 1)) x) =
↑0 x
⊢ ↑(d n A ≫ d (n + 1) A) x = ↑0 x
[PROOFSTEP]
simp only [d_eq, LinearEquiv.toModuleIso_inv, LinearEquiv.toModuleIso_hom, ModuleCat.coe_comp, Function.comp_apply]
/- Porting note: I can see I need to rewrite `LinearEquiv.coe_coe` twice to at
least reduce the need for `symm_apply_apply` to be an `erw`. However, even `erw` refuses to
rewrite the second `coe_coe`... -/
[GOAL]
case h
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Group G
A : Rep k G
n : ℕ
x : ↑((fun n => ModuleCat.of k ((Fin n → G) → CoeSort.coe A)) n)
this :
∀ (x : ↑(HomologicalComplex.X (linearYonedaObjResolution A) n)),
↑(HomologicalComplex.d (linearYonedaObjResolution A) (n + 1) (n + 2))
(↑(HomologicalComplex.d (linearYonedaObjResolution A) n (n + 1)) x) =
↑0 x
⊢ ↑↑(Rep.diagonalHomEquiv (n + 1 + 1) A)
(↑(HomologicalComplex.d (linearYonedaObjResolution A) (n + 1) (n + 1 + 1))
(↑↑(LinearEquiv.symm (Rep.diagonalHomEquiv (n + 1) A))
(↑↑(Rep.diagonalHomEquiv (n + 1) A)
(↑(HomologicalComplex.d (linearYonedaObjResolution A) n (n + 1))
(↑↑(LinearEquiv.symm (Rep.diagonalHomEquiv n A)) x))))) =
↑0 x
[PROOFSTEP]
erw [LinearEquiv.symm_apply_apply, this]
[GOAL]
case h
k G : Type u
inst✝¹ : CommRing k
n✝ : ℕ
inst✝ : Group G
A : Rep k G
n : ℕ
x : ↑((fun n => ModuleCat.of k ((Fin n → G) → CoeSort.coe A)) n)
this :
∀ (x : ↑(HomologicalComplex.X (linearYonedaObjResolution A) n)),
↑(HomologicalComplex.d (linearYonedaObjResolution A) (n + 1) (n + 2))
(↑(HomologicalComplex.d (linearYonedaObjResolution A) n (n + 1)) x) =
↑0 x
⊢ ↑↑(Rep.diagonalHomEquiv (n + 1 + 1) A) (↑0 (↑↑(LinearEquiv.symm (Rep.diagonalHomEquiv n A)) x)) = ↑0 x
[PROOFSTEP]
exact map_zero _
[GOAL]
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
⊢ inhomogeneousCochains A ≅ linearYonedaObjResolution A
[PROOFSTEP]
refine' HomologicalComplex.Hom.isoOfComponents (fun i => (Rep.diagonalHomEquiv i A).toModuleIso.symm) _
[GOAL]
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
⊢ ∀ (i j : ℕ),
ComplexShape.Rel (ComplexShape.up ℕ) i j →
((fun i => (LinearEquiv.toModuleIso (Rep.diagonalHomEquiv i A)).symm) i).hom ≫
HomologicalComplex.d (linearYonedaObjResolution A) i j =
HomologicalComplex.d (inhomogeneousCochains A) i j ≫
((fun i => (LinearEquiv.toModuleIso (Rep.diagonalHomEquiv i A)).symm) j).hom
[PROOFSTEP]
rintro i j (h : i + 1 = j)
[GOAL]
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
i j : ℕ
h : i + 1 = j
⊢ ((fun i => (LinearEquiv.toModuleIso (Rep.diagonalHomEquiv i A)).symm) i).hom ≫
HomologicalComplex.d (linearYonedaObjResolution A) i j =
HomologicalComplex.d (inhomogeneousCochains A) i j ≫
((fun i => (LinearEquiv.toModuleIso (Rep.diagonalHomEquiv i A)).symm) j).hom
[PROOFSTEP]
subst h
[GOAL]
k G : Type u
inst✝¹ : CommRing k
n : ℕ
inst✝ : Group G
A : Rep k G
i : ℕ
⊢ ((fun i => (LinearEquiv.toModuleIso (Rep.diagonalHomEquiv i A)).symm) i).hom ≫
HomologicalComplex.d (linearYonedaObjResolution A) i (i + 1) =
HomologicalComplex.d (inhomogeneousCochains A) i (i + 1) ≫
((fun i => (LinearEquiv.toModuleIso (Rep.diagonalHomEquiv i A)).symm) (i + 1)).hom
[PROOFSTEP]
simp only [CochainComplex.of_d, d_eq, Category.assoc, Iso.symm_hom, Iso.hom_inv_id, Category.comp_id]
|
structure S :=
(x y z : Nat := 0)
def f1 : Nat × Nat → S → Nat :=
by {
intro (x, y);
intro ⟨a, b, c⟩;
exact x+y+a
}
theorem ex1 : f1 (10, 20) { x := 10 } = 40 :=
rfl
def f2 : Nat × Nat → S → Nat :=
by {
intro (a, b) { y := y, .. };
exact a+b+y
}
#eval f2 (10, 20) { y := 5 }
theorem ex2 : f2 (10, 20) { y := 5 } = 35 :=
rfl
def f3 : Nat × Nat → S → S → Nat :=
by {
intro (a, b) { y := y, .. } s;
exact a+b+y+s.x
}
#eval f3 (10, 20) { y := 5 } { x := 1 }
theorem ex3 : f3 (10, 20) { y := 5 } { x := 1 } = 36 :=
rfl
|
[STATEMENT]
lemma vdp_pi_1: "vdp.guards_invar DIM(real \<times> real) [([xsec2' 1 (-2, 0)], vdp_ro)]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. vdp.guards_invar DIM(real \<times> real) [([xsec2' 1 (- 2, 0)], ro 2 10 7 2 2 2)]
[PROOF STEP]
by (auto simp: vdp.guards_invar_def) |
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2006-2012. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
//[doc_managed_heap_memory
#include <boost/interprocess/containers/list.hpp>
#include <boost/interprocess/managed_heap_memory.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <cstddef>
using namespace boost::interprocess;
typedef list<int, allocator<int, managed_heap_memory::segment_manager> >
MyList;
int main ()
{
//We will create a buffer of 1000 bytes to store a list
managed_heap_memory heap_memory(1000);
MyList * mylist = heap_memory.construct<MyList>("MyList")
(heap_memory.get_segment_manager());
//Obtain handle, that identifies the list in the buffer
managed_heap_memory::handle_t list_handle = heap_memory.get_handle_from_address(mylist);
//Fill list until there is no more memory in the buffer
try{
while(1) {
mylist->insert(mylist->begin(), 0);
}
}
catch(const bad_alloc &){
//memory is full
}
//Let's obtain the size of the list
MyList::size_type old_size = mylist->size();
//<-
(void)old_size;
//->
//To make the list bigger, let's increase the heap buffer
//in 1000 bytes more.
heap_memory.grow(1000);
//If memory has been reallocated, the old pointer is invalid, so
//use previously obtained handle to find the new pointer.
mylist = static_cast<MyList *>
(heap_memory.get_address_from_handle(list_handle));
//Fill list until there is no more memory in the buffer
try{
while(1) {
mylist->insert(mylist->begin(), 0);
}
}
catch(const bad_alloc &){
//memory is full
}
//Let's obtain the new size of the list
MyList::size_type new_size = mylist->size();
//<-
(void)new_size;
//->
assert(new_size > old_size);
//Destroy list
heap_memory.destroy_ptr(mylist);
return 0;
}
//]
#include <boost/interprocess/detail/config_end.hpp>
|
= = = = Purging of AoT management = = = =
|
/-
Copyright (c) 2020 Kenny Lau. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kenny Lau
-/
import ring_theory.polynomial.basic
import ring_theory.ideal.local_ring
import tactic.ring_exp
/-!
# Expand a polynomial by a factor of p, so `∑ aₙ xⁿ` becomes `∑ aₙ xⁿᵖ`.
-/
universes u v w
open_locale classical big_operators polynomial
open finset
namespace polynomial
section comm_semiring
variables (R : Type u) [comm_semiring R] {S : Type v} [comm_semiring S] (p q : ℕ)
/-- Expand the polynomial by a factor of p, so `∑ aₙ xⁿ` becomes `∑ aₙ xⁿᵖ`. -/
noncomputable def expand : R[X] →ₐ[R] R[X] :=
{ commutes' := λ r, eval₂_C _ _,
.. (eval₂_ring_hom C (X ^ p) : R[X] →+* R[X]) }
lemma coe_expand : (expand R p : R[X] → R[X]) = eval₂ C (X ^ p) := rfl
variables {R}
lemma expand_eq_sum {f : R[X]} :
expand R p f = f.sum (λ e a, C a * (X ^ p) ^ e) :=
by { dsimp [expand, eval₂], refl, }
@[simp] lemma expand_C (r : R) : expand R p (C r) = C r := eval₂_C _ _
@[simp] lemma expand_X : expand R p X = X ^ p := eval₂_X _ _
@[simp]
theorem expand_expand (f : R[X]) : expand R p (expand R q f) = expand R (p * q) f :=
polynomial.induction_on f (λ r, by simp_rw expand_C)
(λ f g ihf ihg, by simp_rw [alg_hom.map_add, ihf, ihg])
(λ n r ih, by simp_rw [alg_hom.map_mul, expand_C, alg_hom.map_pow, expand_X,
alg_hom.map_pow, expand_X, pow_mul])
theorem expand_mul (f : R[X]) : expand R (p * q) f = expand R p (expand R q f) :=
(expand_expand p q f).symm
@[simp] theorem expand_zero (f : R[X]) : expand R 0 f = C (eval 1 f) :=
by simp [expand]
@[simp] theorem expand_one (f : R[X]) : expand R 1 f = f :=
polynomial.induction_on f
(λ r, by rw expand_C)
(λ f g ihf ihg, by rw [alg_hom.map_add, ihf, ihg])
(λ n r ih, by rw [alg_hom.map_mul, expand_C, alg_hom.map_pow, expand_X, pow_one])
theorem expand_pow (f : R[X]) : expand R (p ^ q) f = (expand R p ^[q] f) :=
nat.rec_on q (by rw [pow_zero, expand_one, function.iterate_zero, id]) $ λ n ih,
by rw [function.iterate_succ_apply', pow_succ, expand_mul, ih]
theorem derivative_expand (f : R[X]) :
(expand R p f).derivative = expand R p f.derivative * (p * X ^ (p - 1)) :=
by rw [coe_expand, derivative_eval₂_C, derivative_pow, derivative_X, mul_one]
theorem coeff_expand {p : ℕ} (hp : 0 < p) (f : R[X]) (n : ℕ) :
(expand R p f).coeff n = if p ∣ n then f.coeff (n / p) else 0 :=
begin
simp only [expand_eq_sum],
simp_rw [coeff_sum, ← pow_mul, C_mul_X_pow_eq_monomial, coeff_monomial, sum],
split_ifs with h,
{ rw [finset.sum_eq_single (n/p), nat.mul_div_cancel' h, if_pos rfl],
{ intros b hb1 hb2, rw if_neg, intro hb3, apply hb2, rw [← hb3, nat.mul_div_cancel_left b hp] },
{ intro hn, rw not_mem_support_iff.1 hn, split_ifs; refl } },
{ rw finset.sum_eq_zero, intros k hk, rw if_neg, exact λ hkn, h ⟨k, hkn.symm⟩, },
end
@[simp] theorem coeff_expand_mul {p : ℕ} (hp : 0 < p) (f : R[X]) (n : ℕ) :
(expand R p f).coeff (n * p) = f.coeff n :=
by rw [coeff_expand hp, if_pos (dvd_mul_left _ _), nat.mul_div_cancel _ hp]
@[simp] theorem coeff_expand_mul' {p : ℕ} (hp : 0 < p) (f : R[X]) (n : ℕ) :
(expand R p f).coeff (p * n) = f.coeff n :=
by rw [mul_comm, coeff_expand_mul hp]
theorem expand_inj {p : ℕ} (hp : 0 < p) {f g : R[X]} :
expand R p f = expand R p g ↔ f = g :=
⟨λ H, ext $ λ n, by rw [← coeff_expand_mul hp, H, coeff_expand_mul hp], congr_arg _⟩
theorem expand_eq_zero {p : ℕ} (hp : 0 < p) {f : R[X]} : expand R p f = 0 ↔ f = 0 :=
by rw [← (expand R p).map_zero, expand_inj hp, alg_hom.map_zero]
theorem expand_eq_C {p : ℕ} (hp : 0 < p) {f : R[X]} {r : R} :
expand R p f = C r ↔ f = C r :=
by rw [← expand_C, expand_inj hp, expand_C]
theorem nat_degree_expand (p : ℕ) (f : R[X]) :
(expand R p f).nat_degree = f.nat_degree * p :=
begin
cases p.eq_zero_or_pos with hp hp,
{ rw [hp, coe_expand, pow_zero, mul_zero, ← C_1, eval₂_hom, nat_degree_C] },
by_cases hf : f = 0,
{ rw [hf, alg_hom.map_zero, nat_degree_zero, zero_mul] },
have hf1 : expand R p f ≠ 0 := mt (expand_eq_zero hp).1 hf,
rw [← with_bot.coe_eq_coe, ← degree_eq_nat_degree hf1],
refine le_antisymm ((degree_le_iff_coeff_zero _ _).2 $ λ n hn, _) _,
{ rw coeff_expand hp, split_ifs with hpn,
{ rw coeff_eq_zero_of_nat_degree_lt, contrapose! hn,
rw [with_bot.coe_le_coe, ← nat.div_mul_cancel hpn], exact nat.mul_le_mul_right p hn },
{ refl } },
{ refine le_degree_of_ne_zero _,
rw [coeff_expand_mul hp, ← leading_coeff], exact mt leading_coeff_eq_zero.1 hf }
end
lemma monic.expand {p : ℕ} {f : R[X]} (hp : 0 < p) (h : f.monic) : (expand R p f).monic :=
begin
rw [monic.def, leading_coeff, nat_degree_expand, coeff_expand hp],
simp [hp, h],
end
theorem map_expand {p : ℕ} {f : R →+* S} {q : R[X]} :
map f (expand R p q) = expand S p (map f q) :=
begin
by_cases hp : p = 0,
{ simp [hp] },
ext,
rw [coeff_map, coeff_expand (nat.pos_of_ne_zero hp), coeff_expand (nat.pos_of_ne_zero hp)],
split_ifs; simp,
end
/-- Expansion is injective. -/
lemma expand_injective {n : ℕ} (hn : 0 < n) :
function.injective (expand R n) :=
λ g g' h, begin
ext,
have h' : (expand R n g).coeff (n * n_1) = (expand R n g').coeff (n * n_1) :=
begin
apply polynomial.ext_iff.1,
exact h,
end,
rw [polynomial.coeff_expand hn g (n * n_1), polynomial.coeff_expand hn g' (n * n_1)] at h',
simp only [if_true, dvd_mul_right] at h',
rw (nat.mul_div_right n_1 hn) at h',
exact h',
end
@[simp]
lemma expand_eval (p : ℕ) (P : R[X]) (r : R) : eval r (expand R p P) = eval (r ^ p) P :=
begin
refine polynomial.induction_on P (λ a, by simp) (λ f g hf hg, _) (λ n a h, by simp),
rw [alg_hom.map_add, eval_add, eval_add, hf, hg]
end
/-- The opposite of `expand`: sends `∑ aₙ xⁿᵖ` to `∑ aₙ xⁿ`. -/
noncomputable def contract (p : ℕ) (f : R[X]) : R[X] :=
∑ n in range (f.nat_degree + 1), monomial n (f.coeff (n * p))
theorem coeff_contract {p : ℕ} (hp : p ≠ 0) (f : R[X]) (n : ℕ) :
(contract p f).coeff n = f.coeff (n * p) :=
begin
simp only [contract, coeff_monomial, sum_ite_eq', finset_sum_coeff, mem_range, not_lt,
ite_eq_left_iff],
assume hn,
apply (coeff_eq_zero_of_nat_degree_lt _).symm,
calc f.nat_degree < f.nat_degree + 1 : nat.lt_succ_self _
... ≤ n * 1 : by simpa only [mul_one] using hn
... ≤ n * p : mul_le_mul_of_nonneg_left (show 1 ≤ p, from hp.bot_lt) (zero_le n)
end
theorem contract_expand {f : R[X]} (hp : p ≠ 0) : contract p (expand R p f) = f :=
begin
ext,
simp [coeff_contract hp, coeff_expand hp.bot_lt, nat.mul_div_cancel _ hp.bot_lt]
end
section char_p
variable [char_p R p]
theorem expand_contract [no_zero_divisors R] {f : R[X]} (hf : f.derivative = 0)
(hp : p ≠ 0) : expand R p (contract p f) = f :=
begin
ext n,
rw [coeff_expand hp.bot_lt, coeff_contract hp],
split_ifs with h,
{ rw nat.div_mul_cancel h },
{ cases n,
{ exact absurd (dvd_zero p) h },
have := coeff_derivative f n,
rw [hf, coeff_zero, zero_eq_mul] at this,
cases this,
{ rw this },
rw [← nat.cast_succ, char_p.cast_eq_zero_iff R p] at this,
exact absurd this h }
end
variable [hp : fact p.prime]
include hp
theorem expand_char (f : R[X]) : map (frobenius R p) (expand R p f) = f ^ p :=
begin
refine f.induction_on' (λ a b ha hb, _) (λ n a, _),
{ rw [alg_hom.map_add, polynomial.map_add, ha, hb, add_pow_char], },
{ rw [expand_monomial, map_monomial, monomial_eq_C_mul_X, monomial_eq_C_mul_X,
mul_pow, ← C.map_pow, frobenius_def],
ring_exp }
end
theorem map_expand_pow_char (f : R[X]) (n : ℕ) :
map ((frobenius R p) ^ n) (expand R (p ^ n) f) = f ^ (p ^ n) :=
begin
induction n,
{ simp [ring_hom.one_def] },
symmetry,
rw [pow_succ', pow_mul, ← n_ih, ← expand_char, pow_succ, ring_hom.mul_def,
← map_map, mul_comm, expand_mul, ← map_expand]
end
end char_p
end comm_semiring
section is_domain
variables (R : Type u) [comm_ring R] [is_domain R]
theorem is_local_ring_hom_expand {p : ℕ} (hp : 0 < p) :
is_local_ring_hom (↑(expand R p) : R[X] →+* R[X]) :=
begin
refine ⟨λ f hf1, _⟩, rw ← coe_fn_coe_base at hf1,
have hf2 := eq_C_of_degree_eq_zero (degree_eq_zero_of_is_unit hf1),
rw [coeff_expand hp, if_pos (dvd_zero _), p.zero_div] at hf2,
rw [hf2, is_unit_C] at hf1, rw expand_eq_C hp at hf2, rwa [hf2, is_unit_C]
end
variable {R}
theorem of_irreducible_expand {p : ℕ} (hp : p ≠ 0) {f : R[X]}
(hf : irreducible (expand R p f)) : irreducible f :=
@@of_irreducible_map _ _ _ (is_local_ring_hom_expand R hp.bot_lt) hf
theorem of_irreducible_expand_pow {p : ℕ} (hp : p ≠ 0) {f : R[X]} {n : ℕ} :
irreducible (expand R (p ^ n) f) → irreducible f :=
nat.rec_on n (λ hf, by rwa [pow_zero, expand_one] at hf) $ λ n ih hf,
ih $ of_irreducible_expand hp $ by { rw pow_succ at hf, rwa [expand_expand] }
end is_domain
end polynomial
|
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include <algorithm>
#include <boost/bind.hpp>
#include <boost/function.hpp>
#include <boost/noncopyable.hpp>
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include "windowing/DllWaylandClient.h"
#include "utils/log.h"
#include "Wayland11EventQueueStrategy.h"
namespace xwe = xbmc::wayland::events;
namespace xw11 = xbmc::wayland::version_11;
/* It is very important that these functions occurr in the order.
* that they are written below. Deadlocks might occurr otherwise.
*
* The first function dispatches any pending events that have been
* determined from prior reads of the event queue without *also*
* reading the event queue.
*
* The second function function reads the input buffer and dispatches
* any events that occurred, but only after the reading thread goes
* to sleep waiting for new data to arrive on the pipe.
*
* The output buffer will be flushed periodically (on the render loop,
* which never sleeps) and will flush any pending requests after
* eglSwapBuffers that may have happened just before this thread starts
* polling.
*
* If the functions are not called in this order, you might run into
* a situation where pending-dispatch events might have generated a
* write to the event queue in order to keep us awake (frame events
* are a particular culprit here), or where events that we need to
* dispatch in order to keep going are never read.
*/
namespace
{
void DispatchPendingEvents(IDllWaylandClient &clientLibrary,
struct wl_display *display)
{
clientLibrary.wl_display_dispatch_pending(display);
/* We flush the output queue in the main thread as that needs to
* happen after eglSwapBuffers */
}
void ReadAndDispatch(IDllWaylandClient &clientLibrary,
struct wl_display *display)
{
clientLibrary.wl_display_dispatch(display);
}
}
xw11::EventQueueStrategy::EventQueueStrategy(IDllWaylandClient &clientLibrary,
struct wl_display *display) :
m_clientLibrary(clientLibrary),
m_display(display),
m_thread(boost::bind(ReadAndDispatch,
boost::ref(m_clientLibrary),
m_display),
boost::bind(DispatchPendingEvents,
boost::ref(m_clientLibrary),
m_display),
m_clientLibrary.wl_display_get_fd(m_display))
{
}
namespace
{
void ExecuteAction(const xwe::IEventQueueStrategy::Action &action)
{
action();
}
}
void
xw11::EventQueueStrategy::DispatchEventsFromMain()
{
unsigned int numActions = 0;
std::vector<Action> pendingActions;
/* We only need to hold the lock while we copy out actions from the
* queue */
{
CSingleLock lock(m_actionsMutex);
numActions = m_actions.size();
pendingActions.reserve(numActions);
/* Only pump the initial queued event count otherwise if the UI
* keeps pushing events then the loop won't finish */
for (unsigned int index = 0; index < numActions; ++index)
{
pendingActions.push_back(m_actions.front());
m_actions.pop();
}
}
/* Execute each of the queued up actions */
std::for_each(pendingActions.begin(),
pendingActions.end(),
ExecuteAction);
/* After we've done dispatching flush the event queue */
m_clientLibrary.wl_display_flush(m_display);
}
void
xw11::EventQueueStrategy::PushAction(const Action &action)
{
CSingleLock lock(m_actionsMutex);
m_actions.push(action);
}
|
-- Borrowed from Botta at https://gitlab.pik-potsdam.de/botta/IdrisLibs/blob/master/Nat/LTEProperties.lidr
module Positive
%default total
%access public export
%auto_implicits on
|||
data Positive : Nat -> Type where
MkPositive : {n : Nat} -> Positive (S n)
|||
fromSucc : (m : Nat) -> (n : Nat) -> S m = n -> Positive n
fromSucc m n prf = s2 where
s1 : Positive (S m)
s1 = MkPositive
s2 : Positive n
s2 = replace prf s1
|||
implementation Uninhabited (Positive Z) where
uninhabited (MkPositive {n}) impossible
|||
positiveNotZ : {n : Nat} -> Positive n -> Not (n = Z)
positiveNotZ {n = Z} p = absurd p
positiveNotZ {n = S m} _ = SIsNotZ
|||
plusPreservesPositivity : Positive m -> Positive n -> Positive (m + n)
plusPreservesPositivity {m = Z } {n } MkPositive _ impossible
plusPreservesPositivity {m } {n = Z } _ MkPositive impossible
plusPreservesPositivity {m = S m} {n = S n} _ _ = MkPositive
|||
multPreservesPositivity : Positive m -> Positive n -> Positive (m * n)
multPreservesPositivity {m = Z } {n } MkPositive _ impossible
multPreservesPositivity {m } {n = Z } _ MkPositive impossible
multPreservesPositivity {m = S m} {n = S n} _ _ = MkPositive
|
theory Chapter05_06
imports Chapter04
begin
primrec is_val :: "expr => bool"
where "is_val (Var v) = False"
| "is_val (Num x) = True"
| "is_val (Str s) = True"
| "is_val (Plus e1 e2) = False"
| "is_val (Times e1 e2) = False"
| "is_val (Cat e1 e2) = False"
| "is_val (Len e) = False"
| "is_val (Let e1 e2) = False"
inductive eval :: "expr => expr => bool"
where eval_plus_1 [simp]: "eval (Plus (Num n1) (Num n2)) (Num (n1 + n2))"
| eval_plus_2 [simp]: "eval e1 e1' ==> eval (Plus e1 e2) (Plus e1' e2)"
| eval_plus_3 [simp]: "is_val e1 ==> eval e2 e2' ==> eval (Plus e1 e2) (Plus e1 e2')"
| eval_times_1 [simp]: "eval (Times (Num n1) (Num n2)) (Num (n1 * n2))"
| eval_times_2 [simp]: "eval e1 e1' ==> eval (Times e1 e2) (Times e1' e2)"
| eval_times_3 [simp]: "is_val e1 ==> eval e2 e2' ==> eval (Times e1 e2) (Times e1 e2')"
| eval_cat_1 [simp]: "eval (Cat (Str n1) (Str n2)) (Str (n1 @ n2))"
| eval_cat_2 [simp]: "eval e1 e1' ==> eval (Cat e1 e2) (Cat e1' e2)"
| eval_cat_3 [simp]: "is_val e1 ==> eval e2 e2' ==> eval (Cat e1 e2) (Cat e1 e2')"
| eval_len_1 [simp]: "eval (Len (Str n1)) (Num (int (length n1)))"
| eval_len_2 [simp]: "eval e1 e1' ==> eval (Len e1) (Len e1')"
| eval_let_1 [simp]: "is_val e1 ==> eval (Let e1 e2) (subst e1 first e2)"
| eval_let_2 [simp]: "eval e1 e1' ==> eval (Let e1 e2) (Let e1' e2)"
lemma canonical_num: "is_val e ==> typecheck gam e NumType ==> EX n. e = Num n"
by (induction e, auto)
lemma canonical_str: "is_val e ==> typecheck gam e StrType ==> EX n. e = Str n"
by (induction e, auto)
theorem preservation: "eval e e' ==> typecheck gam e t ==> typecheck gam e' t"
by (induction e e' arbitrary: t rule: eval.induct, fastforce+)
theorem progress: "typecheck gam e t ==> gam = empty_env ==> is_val e | (EX e'. eval e e')"
proof (induction gam e t rule: typecheck.induct)
case tc_var
thus ?case by simp
next case tc_str
thus ?case by simp
next case tc_num
thus ?case by simp
next case (tc_plus gam e1 e2)
thus ?case by (metis eval_plus_1 eval_plus_2 eval_plus_3 canonical_num)
next case (tc_times gam e1 e2)
thus ?case by (metis eval_times_1 eval_times_2 eval_times_3 canonical_num)
next case (tc_cat gam e1 e2)
thus ?case by (metis eval_cat_1 eval_cat_2 eval_cat_3 canonical_str)
next case (tc_len gam e)
thus ?case by (metis eval_len_1 eval_len_2 canonical_str)
next case (tc_let gam e1 t1 e2 t2)
thus ?case by (metis eval_let_1 eval_let_2)
qed
end
|
/-
Copyright (c) 2021 Yury Kudryashov. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Yury Kudryashov
! This file was ported from Lean 3 source module measure_theory.measure.complex_lebesgue
! leanprover-community/mathlib commit 468b141b14016d54b479eb7a0fff1e360b7e3cf6
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathbin.MeasureTheory.Measure.Lebesgue
/-!
# Lebesgue measure on `ℂ`
In this file we define Lebesgue measure on `ℂ`. Since `ℂ` is defined as a `structure` as the
push-forward of the volume on `ℝ²` under the natural isomorphism. There are (at least) two
frequently used ways to represent `ℝ²` in `mathlib`: `ℝ × ℝ` and `fin 2 → ℝ`. We define measurable
equivalences (`measurable_equiv`) to both types and prove that both of them are volume preserving
(in the sense of `measure_theory.measure_preserving`).
-/
open MeasureTheory
noncomputable section
namespace Complex
/-- Lebesgue measure on `ℂ`. -/
instance measureSpace : MeasureSpace ℂ :=
⟨Measure.map basisOneI.equivFun.symm volume⟩
#align complex.measure_space Complex.measureSpace
/-- Measurable equivalence between `ℂ` and `ℝ² = fin 2 → ℝ`. -/
def measurableEquivPi : ℂ ≃ᵐ (Fin 2 → ℝ) :=
basisOneI.equivFun.toContinuousLinearEquiv.toHomeomorph.toMeasurableEquiv
#align complex.measurable_equiv_pi Complex.measurableEquivPi
/-- Measurable equivalence between `ℂ` and `ℝ × ℝ`. -/
def measurableEquivRealProd : ℂ ≃ᵐ ℝ × ℝ :=
equivRealProdClm.toHomeomorph.toMeasurableEquiv
#align complex.measurable_equiv_real_prod Complex.measurableEquivRealProd
theorem volumePreservingEquivPi : MeasurePreserving measurableEquivPi :=
(measurableEquivPi.symm.Measurable.MeasurePreserving _).symm _
#align complex.volume_preserving_equiv_pi Complex.volumePreservingEquivPi
theorem volumePreservingEquivRealProd : MeasurePreserving measurableEquivRealProd :=
(volumePreservingFinTwoArrow ℝ).comp volumePreservingEquivPi
#align complex.volume_preserving_equiv_real_prod Complex.volumePreservingEquivRealProd
end Complex
|
module Multisession
using DocStringExtensions
using Combinatorics
using Caesar
using Neo4j, CloudGraphs
export
getSessionsForEnvironment,
getEnvironmentPrimeLandmarkNodes,
getSessionLandmarks,
getFederatedGraphElements,
buildPrimeLandmarksAndFactors,
getMultiSessionFg,
updateLandmarkProducts
"""
$(SIGNATURES)
Return all binary pair combinations of sessions and return a Vector::Tuple{String, String}.
Example
-------
```julia
str = ["a";"b";"c";"d"]
pstr = stringPairs(str)
@assert length(pstr) == 6
```
"""
function stringPairs(strs::Vector{<:AbstractString} )::Vector{Tuple{String, String}}
ret = Tuple{String,String}[]
for co in combinations( strs )
if length(co) == 2
push!(ret, (co[1], co[2]))
end
end
return ret
end
"""
$(SIGNATURES)
Gets a vector of session IDs that are related to an environment.
"""
function getSessionsForEnvironment(
connection::Neo4j.Connection,
environment::String)::Vector{String}
query = "match (env:ENVIRONMENT:$environment)-[SESSION]->(s:SESSION) return s.id"
cph, = Caesar.executeQuery(connection, query)
return map(s -> s["row"][1], cph.results[1]["data"])
end
"""
$(SIGNATURES)
Get a dictionary (label => Neo4j node) of all prime nodes for a given set of sessions and an environment.
"""
function getEnvironmentPrimeLandmarkNodes(cloudGraph::CloudGraph, sessions::Vector{String}, environment::String)::Dict{String, Neo4j.Node}
# TODO - refactor prime labels as a special snowflake - m or something like `:m14` is better -- still need to test and upgrade IIF for this
query = "match (node:MULTISESSION:LANDMARK) where ("*join("(node:".*sessions.*")", " or ")*") and node.environment = \"$environment\" return id(node)"
cph, = Caesar.executeQuery(cloudGraph.neo4j.connection, query)
existPrimeNodes = map(node -> getnode(cloudGraph.neo4j.graph, node["row"][1]), cph.results[1]["data"])
labels = map(n -> getnodeproperty(n, "label"), existPrimeNodes)
# Dictionary of all existing prime nodes...
existPrimeNodes = Dict(labels .=> existPrimeNodes)
return existPrimeNodes
end
"""
$(SIGNATURES)
Gets all landmark IDs for a given session, excluding multisession.
"""
# TODO: This should be a generic function...
function getSessionLandmarks(
conn::Neo4j.Connection,
sessionId::String,
robotId::String,
userId::String)::Vector{String}
query = "match (landmark:$sessionId:$robotId:$userId:LANDMARK) where NOT landmark:MULTISESSION return landmark.label"
cph, = Caesar.executeQuery(conn, query)
return map(s -> s["row"][1], cph.results[1]["data"])
end
"""
$(SIGNATURES)
Very specific method to check if a prime factor exists between a session landmark and a prime node.
Prime node is identified by NeoNode ID.
"""
function _doesPrimeFactorExistByForSessionLandmark(
conn::Neo4j.Connection,
sessionId::String,
robotId::String,
userId::String,
primeLandmarkNeoNodeId::Int)::Bool
query = "match (node:LANDMARK:$sessionId:$robotId:$userId)-[:DEPENDENCE]-(f:FACTOR)-[:DEPENDENCE]-(m:MULTISESSION) where id(m)=$(primeLandmarkNeoNodeId) return id(node)"
cph, = Caesar.executeQuery(conn, query)
return length(cph.results[1]["data"]) > 0 # If it exists return true.
end
"""
$(SIGNATURES)
Returns the tuples of the prime landmark -> prime factor -> session landmark for all existing prime factors.
Tuple elements: mid, mlabel, fid, flabel, lid, llabel
May contain duplicates elements (e.g. two prime factors for one prime landmark).
"""
function getFederatedGraphElements(
connection::Neo4j.Connection,
sessions::Vector{String},
environment::String)::Vector{Tuple}
query = "match (m:LANDMARK:MULTISESSION)--(f:FACTOR:MULTISESSION)--(l:LANDMARK) where "*(prod("m:".*sessions.*" or ")[1:(end-4)])*" and m.environment=\"$environment\" return id(m), m.label, id(f), f.label, id(l), l.label"
cph, = Caesar.executeQuery(connection, query)
elements = Vector{Tuple}()
for data in cph.results[1]["data"]
#Tuple elements: mid, mlabel, fid, flabel, lid, llabel
push!(elements, (data["row"][1], Symbol(data["row"][2]), data["row"][3], Symbol(data["row"][4]), data["row"][5], Symbol(data["row"][6])))
end
return elements
end
"""
$(SIGNATURES)
McFlurry step.
Builds the prime landmarks and prime factors for a given environment and sessions (if they don't exist).
Returns all prime landmarks.
"""
function buildPrimeLandmarksAndFactors(
cloudGraph::CloudGraph,
sessionLandmarks::Dict{String, Vector{String}},
robotId::String,
userId::String,
environment::String)::Dict{String, Neo4j.Node}
@debug " - Checking and updating each combination of sessions for same landmarks..."
sessions = collect(keys(sessionLandmarks))
sessionPairs = stringPairs(sessions)
primeLandmarkNodes = getEnvironmentPrimeLandmarkNodes(cloudGraph, sessions, environment)
for (s1,s2) in sessionPairs
@info " - Creating landmark links between '$s1' and '$s2'"
# TODO: Find a better way to for landmark equivalence check
# TODO: Check that the landmarks are the same type
commonLandmarks = intersect(sessionLandmarks[s1], sessionLandmarks[s2])
@info " - Common landmark set: $commonLandmarks"
for commonLandmark in commonLandmarks
@info " - Checking common landmark $commonLandmark..."
# Make the prime variable if it doesn't exist
sym = Symbol("l"*string(parse(Int, commonLandmark[2:end])+100000))
if !haskey(primeLandmarkNodes, String(sym))
# TODO: be generic about which variables and factor types to use
# Make a prime and add to db+list
@info " - Adding a prime landmark variable $sym..."
fg = initfg(cloudgraph=cloudGraph, robotname=robotId, username=userId, sessionname=s1)
# Check the softtypes to make sure they match.
# TODO: FRACK GETTING AGAIN... YEESH
land1 = Caesar.getCloudVert(cloudGraph, s1, robotId, userId, sym=Symbol(commonLandmark))
land2 = Caesar.getCloudVert(cloudGraph, s2, robotId, userId, sym=Symbol(commonLandmark))
if typeof(land1.packed.softtype) != typeof(land2.packed.softtype)
@error "Softtypes don't match for $s1:$sym (got $(typeof(land1.packed.softtype))) and $s2:$sym (got $(typeof(land2.packed.softtype)))"
continue
end
addVariable!(fg, sym, deepcopy(land1.packed.softtype), tags=[:MULTISESSION; :LANDMARK; Symbol(s1); Symbol(s2); Symbol(userId); Symbol(robotId)], uid=100000)
# NOTE: Until DFG, all prime variables have exVertexId of 100000
# Add the environment property
setnodeproperty(getnode(cloudGraph.neo4j.graph, fg.cgIDs[100000]), "environment", environment)
@debug " - Added prime landmark!"
# primeLandmarkNodes[string(sym)] = primeLandmarkNodes
# Repull the existing prime nodes!
primeLandmarkNodes = getEnvironmentPrimeLandmarkNodes(cloudGraph, sessions, environment)
else
@info " - Prime landmark $sym already exists, making sure it has all the labels!"
addnodelabels(primeLandmarkNodes[String(sym)], [s1, s2])
end
# check if factor already exists
prime = primeLandmarkNodes[string(sym)]
for s in [s1, s2]
if !_doesPrimeFactorExistByForSessionLandmark(cloudGraph.neo4j.connection, s, robotId, userId, prime.id)
@info " - Adding a factor between session landmark '$commonLandmark' and prime landmark '$sym' for session $s..."
# add new factor that between session landmark and prime landmark
fg = initfg(cloudgraph=cloudGraph, robotname=robotId, username=userId, sessionname=s)
syms = [Symbol(commonLandmark);sym]
@debug " - Copying local symbols $syms..."
Caesar.subLocalGraphCopy!(fg, syms, neighbors=0, reqbackendset=false, reqSolvable=false, includeMultisession=true)
# Note: this shouldn't be necessary because the check is done in the landmark creation, but doing just in case here too.
@show sessionLandType = getData(getVert(fg, syms[1], api=localapi)).softtype
@show primeLandType = getData(getVert(fg, syms[2], api=localapi)).softtype
if typeof(sessionLandType) != typeof(primeLandType)
@error "Softtypes don't match for $syms (got $(typeof(sessionLandType))) and (got $(typeof(primeLandType)))"
continue
end
newFactorType = string(typeof(sessionLandType).name)*string(typeof(primeLandType).name)
@debug " - Trying to create a factor linking $syms of type $newFactorType ..."
# How do i create a Point2Point2 or Pose2Pose2 generically.
newPrimeFactor = Point2Point2(MvNormal(zeros(2), 1e-4*Matrix(LinearAlgebra.I, 2,2) ))
@warn "Currently would like a factor of type $newFactorType, but hard-coded to create Point2Point2's. Please fix in FederatedSolving.jl!"
addFactor!(fg, syms, newPrimeFactor, uid=100001, tags=[:FACTOR; :MULTISESSION; Symbol(userId); Symbol(robotId); Symbol(s)], autoinit=false)
# NOTE: Until DFG, all prime variables have exVertexId of 100000
# Add the environment property
setnodeproperty(getnode(cloudGraph.neo4j.graph, fg.cgIDs[100001]), "environment", environment)
else
@debug " - Factor link already exists, continuing..."
end
end
end
end
return primeLandmarkNodes
end
"""
$(SIGNATURES)
Create a Caesar FactorGraph that contains all landmarks and factors in a multisession
federated solve.
"""
function getMultiSessionFg(
cloudGraph::CloudGraph,
sessions::Vector{String},
environment::String)
# #
fg = initfg(cloudgraph=cloudGraph)
# 1. Get all federated elements - Vector of tuples (mid, mlabel, fid, flabel, lid, llabel)
federatedGraphElements = getFederatedGraphElements(cloudGraph.neo4j.connection, sessions, environment)
localIndex = 1
for (mid, mlabel, fid, flabel, lid, llabel) in federatedGraphElements
# make the local index unique
origlabel = llabel
llabel = Symbol(string(llabel, "_", localIndex))
# If prime landmark not in FG, add it
if !(mid in values(fg.IDs))
mvert = CloudGraphs.get_vertex(fg.cg, mid, false)
addVariable!(fg, mlabel, mvert.packed.softtype, api=IIF.localapi, uid=mid)
getVert(fg, mlabel, api=localapi).attributes["origlabel"] = mlabel
# Manually add the cloud node IDs
push!(fg.cgIDs, mvert.neo4jNodeId => mvert.neo4jNodeId)
end
# If session landmark not in FG, add it
if !(lid in values(fg.IDs))
lvert = CloudGraphs.get_vertex(fg.cg, lid, false)
addVariable!(fg, llabel, lvert.packed.softtype, api=IIF.localapi, uid=lid)
getVert(fg, llabel, api=localapi).attributes["origlabel"] = origlabel
Caesar.setValKDE!(fg, llabel, kde!(lvert.packed.val), api=IIF.localapi)
# Manually add the cloud node IDs
push!(fg.cgIDs, lvert.neo4jNodeId => lvert.neo4jNodeId)
# Keep local label index unique
localIndex += 1
end
# If prime factor (l1 prime -- l1 session) not in FG, add it
if !(fid in values(fg.fIDs))
vm = fg.g.vertices[mid]
vl = fg.g.vertices[lid]
fvert = CloudGraphs.get_vertex(fg.cg, fid, false)
addFactor!(fg, [llabel; mlabel], fvert.packed.fnc.usrfnc!, api=IIF.localapi, uid=fid, autoinit=false)
end
end
return fg
end
"""
$(SIGNATURES)
Updates the specified list of landmarks using local products.
Returns a symbol dictionary of the provided landmarks and a tuple of (new KDE, KDE propsals),
which is useful for plotting with plotKDE.
"""
function updateLandmarkProducts(
fg::G,
landmarkSymbols::Vector{Symbol},
shouldFreeze::Bool)::Dict{Symbol, Tuple{BallTreeDensity, Vector{BallTreeDensity}}} where G <: AbstractDFG
retDict = Dict{Symbol, Tuple{BallTreeDensity, Vector{BallTreeDensity}}}()
for landmarkSymbol in landmarkSymbols
@debug "Calculating local product for $landmarkSymbol..."
# Update calculate the local product and persist it
newkde, kdeproposals = IIF.localProduct(fg, landmarkSymbol, api=IIF.localapi)
# SetValKDE does not do what we need here - do by hand...
# Get local, update cloud.
vert = getVert(fg, landmarkSymbol, api=IIF.localapi)
data = getData(vert)
data.val = getPoints(newkde)
if shouldFreeze
@debug "Freezing $landmarkSymbol..."
# Freeze the landmark (TODO: May be overcooked, possibly refactore)
data.ismargin = true
end
vert.attributes["label"] = vert.attributes["origlabel"]
setData!(vert, data)
@debug "Updating $landmarkSymbol on server..."
# Fix the label before writing back
dlapi.updatevertex!(fg, vert)
#setValKde is not right call :/
# setValKDE!(fg, landmarkSymbol, newkde, api=IIF.dlapi)
push!(retDict, landmarkSymbol=>(newkde, kdeproposals))
end
return retDict
end
return nothing
end
|
/-
Copyright (c) 2018 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Simon Hudon
! This file was ported from Lean 3 source module data.list.tfae
! leanprover-community/mathlib commit 5a3e819569b0f12cbec59d740a2613018e7b8eec
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
import Mathlib.Data.List.Basic
import Mathlib.Init.Data.List.Basic
/-!
# The Following Are Equivalent
This file allows to state that all propositions in a list are equivalent. It is used by
`Mathlib.Tactic.Tfae`.
`TFAE l` means `∀ x ∈ l, ∀ y ∈ l, x ↔ y`. This is equivalent to `pairwise (↔) l`.
-/
namespace List
/-- TFAE: The Following (propositions) Are Equivalent.
The `tfae_have` and `tfae_finish` tactics can be useful in proofs with `TFAE` goals.
-/
def TFAE (l : List Prop) : Prop :=
∀ x ∈ l, ∀ y ∈ l, x ↔ y
#align list.tfae List.TFAE
theorem tfae_nil : TFAE [] :=
forall_mem_nil _
#align list.tfae_nil List.tfae_nil
theorem tfae_singleton (p) : TFAE [p] := by simp [TFAE, -eq_iff_iff]
#align list.tfae_singleton List.tfae_singleton
theorem tfae_cons_of_mem {a b} {l : List Prop} (h : b ∈ l) : TFAE (a :: l) ↔ (a ↔ b) ∧ TFAE l :=
⟨fun H => ⟨H a (by simp) b (Mem.tail a h),
fun p hp q hq => H _ (Mem.tail a hp) _ (Mem.tail a hq)⟩,
by
rintro ⟨ab, H⟩ p (_ | ⟨_, hp⟩) q (_ | ⟨_, hq⟩)
· rfl
· exact ab.trans (H _ h _ hq)
· exact (ab.trans (H _ h _ hp)).symm
· exact H _ hp _ hq⟩
#align list.tfae_cons_of_mem List.tfae_cons_of_mem
theorem tfae_cons_cons {a b} {l : List Prop} : TFAE (a :: b :: l) ↔ (a ↔ b) ∧ TFAE (b :: l) :=
tfae_cons_of_mem (Mem.head _)
#align list.tfae_cons_cons List.tfae_cons_cons
theorem tfae_of_forall (b : Prop) (l : List Prop) (h : ∀ a ∈ l, a ↔ b) : TFAE l :=
fun _a₁ h₁ _a₂ h₂ => (h _ h₁).trans (h _ h₂).symm
#align list.tfae_of_forall List.tfae_of_forall
theorem tfae_of_cycle {a b} {l : List Prop} :
List.Chain (· → ·) a (b :: l) → (ilast' b l → a) → TFAE (a :: b :: l) := by
induction' l with c l IH generalizing a b <;>
simp only [tfae_cons_cons, tfae_singleton, and_true_iff, chain_cons, Chain.nil] at *
· intro a b
exact Iff.intro a b
rintro ⟨ab, ⟨bc, ch⟩⟩ la
have := IH ⟨bc, ch⟩ (ab ∘ la)
exact ⟨⟨ab, la ∘ (this.2 c (Mem.head _) _ (ilast'_mem _ _)).1 ∘ bc⟩, this⟩
#align list.tfae_of_cycle List.tfae_of_cycle
theorem TFAE.out {l} (h : TFAE l) (n₁ n₂) {a b} (h₁ : List.get? l n₁ = some a := by rfl)
(h₂ : List.get? l n₂ = some b := by rfl) : a ↔ b :=
h _ (List.get?_mem h₁) _ (List.get?_mem h₂)
#align list.tfae.out List.TFAE.out
end List
|
lemma Un_range_binary: "a \<union> b = (\<Union>i::nat. binary a b i)" |
lemma islimpt_EMPTY[simp]: "\<not> x islimpt {}" |
theory mfspace
imports mdom_mran
begin
context Function_Model begin
definition mfspace' :: \<open>'a \<Rightarrow> 'a \<Rightarrow> 'a\<close>
where "mfspace' x y \<equiv>
<set, { <func, f> | f \<in> (snd x \<ominus> func) \<midarrow>p\<rightarrow> (snd y \<ominus> func) }>"
definition mfspace :: \<open>'a \<Rightarrow> 'a \<Rightarrow> 'a\<close>
where "mfspace x y \<equiv> if x : mSet \<and> y : mSet
then mfspace' x y
else Function_Model_mdefault"
lemma mfspace_eq :
assumes x : "x : mSet" and y : "y : mSet"
shows "mfspace x y \<equiv>
<set, { <func, f> | f \<in> (snd x \<ominus> func) \<midarrow>p\<rightarrow> (snd y \<ominus> func) }>"
unfolding mfspace_def mfspace'_def
using assms by auto
lemma mfspace_typ :
"mfspace : mSet \<rightarrow> mSet \<rightarrow> mSetOf mFunc"
proof (rule funI, rule funI, rule msetofI)
thm mI_mset ex_func_set ex_func_set_subset
fix x y assume
x : "x : mSet" and y : "y : mSet"
then obtain i x' j y' where
i : "i : Ord" and x_eq : "x = <set, x'>" and
x' : "x' : Set" and x'_sub:"x' \<subseteq> Tier i \<ominus> set" and
j : "j : Ord" and y_eq : "y = <set,y'>" and
y' : "y' : Set" and y'_sub:"y' \<subseteq> Tier j \<ominus> set"
using mE_mset[OF mset_m] msetE by (metis)
obtain k where
k : "k : Ord" and "x' \<subseteq> Tier k" "y' \<subseteq> Tier k"
using greatest_tier_subset[OF i j,
OF ex_subset2[OF x' tier_set[OF i] x'_sub],
OF ex_subset2[OF y' tier_set[OF j] y'_sub]] .
hence
x'_sub : "x' \<ominus> func \<subseteq> Tier k \<ominus> func" and
y'_sub : "y' \<ominus> func \<subseteq> Tier k \<ominus> func"
using ex_subset3[OF x' tier_set[OF k], of func]
ex_subset3[OF y' tier_set[OF k], of func]
by auto
have f_mem:"\<And>f. f \<in> { <func, f'> | f' \<in> (x' \<ominus> func) \<midarrow>p\<rightarrow> (y' \<ominus> func) } \<Longrightarrow>
f \<in> Tier (succ k) \<ominus> set \<and> f : mFunc"
proof (rule, rule exsetI[OF tier_set[OF succ_ord[OF k]]])
fix f assume
"f \<in> { <func, f'> | f' \<in> (x' \<ominus> func) \<midarrow>p\<rightarrow> (y' \<ominus> func) }"
then obtain f' where
f : "f = <func, f'>" and "f' \<in> (x' \<ominus> func) \<midarrow>p\<rightarrow> (y' \<ominus> func)"
using repfunE[OF setof_set[OF fspace_setof[OF exset_set[OF x'] exset_set[OF y']]]]
by metis
hence "f' : Function" "dom f' \<subseteq> x' \<ominus> func" "ran f' \<subseteq> y' \<ominus> func"
using fspace_mem[OF exset_set[OF x'] exset_set[OF y']]
fspaceD[OF exset_set[OF x'] exset_set[OF y']] by auto
thus "f \<in> Tier (succ k)"
unfolding f
using tierI_mfunc[OF k] subset_trans[OF _ x'_sub] subset_trans[OF _ y'_sub]
by auto
thus "f : mFunc"
using mfuncI[OF mI[OF succ_ord[OF k]]]
unfolding f by auto
show "\<not> Excluded set f"
using func_set_excluded func_not_excluded
unfolding f subtyp_def has_ty_def by auto
qed
thus "mfspace x y : mSet"
using msetI[OF mI_mset[OF succ_ord[OF k]
repfun_set[OF setof_set[OF
fspace_setof[OF exset_set[OF x', of func] exset_set[OF y', of func]]]] subsetI]]
unfolding mfspace_eq[OF x y]
unfolding mset_snd_eq'[OF x'] mset_snd_eq'[OF y'] x_eq y_eq
by auto
fix f assume "f m mfspace x y"
thus "f : mFunc"
unfolding mfspace_eq[OF x y]
unfolding x_eq y_eq mset_snd_eq'[OF x'] mset_snd_eq'[OF y']
using f_mem mmemD by auto
qed
lemmas mfspace_msetof = funE[OF funE[OF mfspace_typ]]
lemma mfspace_typ_ax :
"m\<forall>x0. x0 : mSet \<longrightarrow> (m\<forall>x1. x1 : mSet \<longrightarrow> mfspace x0 x1 : mSetOf mFunc)"
unfolding mall_def tall_def
using mfspace_msetof by auto
lemma mfspace_iff :
assumes x : "x : mSet" and y : "y : mSet"
and f : "f : mFunc"
shows "f m mfspace x y \<longleftrightarrow> mSubset (mdom f) x \<and> mSubset (mran f) y "
proof (auto)
assume "f m mfspace x y"
hence "f \<in> {<func, f'> | f' \<in> (snd x \<ominus> func) \<midarrow>p\<rightarrow> (snd y \<ominus> func)}"
unfolding mfspace_eq[OF x y]
using mmemD by auto
then obtain f' where
"f = <func, f'>" "f' \<in> (snd x \<ominus> func) \<midarrow>p\<rightarrow> (snd y \<ominus> func)"
using repfunE[OF setof_set[OF
fspace_setof[OF exset_set[OF mset_snd_set] exset_set[OF mset_snd_set], OF x y]]]
by metis
hence "dom f' \<subseteq> snd x \<ominus> func" "ran f' \<subseteq> snd y \<ominus> func"
using fspaceD[OF exset_set[OF mset_snd_set] exset_set[OF mset_snd_set], OF x y]
by auto
hence dom:"dom (snd f) \<subseteq> snd x" and ran: "ran (snd f) \<subseteq> snd y"
using mfunc_snd_eq f
ex_subset2[OF dom_set[OF mfunc_snd_func[OF f]] mset_snd_set[OF x]]
ex_subset2[OF ran_set[OF mfunc_snd_func[OF f]] mset_snd_set[OF y]]
unfolding \<open>f = <func,f'>\<close>
by auto
show "mSubset (mdom f) x"
by (rule msubsetI, unfold mdom_eq[OF f], drule mmemD,
unfold mMem_def, use dom x in auto)
show "mSubset (mran f) y"
by (rule msubsetI, unfold mran_eq[OF f], drule mmemD,
unfold mMem_def, use ran y in auto)
next
obtain f' j where
f' : "f' : Function" and f_eq : "f = <func, f'>" and
j : "j : Ord" and dom :"dom f' \<subseteq> Tier j \<ominus> func" and
ran : "ran f' \<subseteq> Tier j \<ominus> func"
using mfuncE2[OF f] .
assume x_sub:"mSubset (mdom f) x" and y_sub: "mSubset (mran f) y"
have "dom (snd f) \<subseteq> snd x" "ran (snd f) \<subseteq> snd y"
using msubsetD[OF x_sub] msubsetD[OF y_sub] mmemI mMem_def
mdom_mset[OF f] mran_mset[OF f]
unfolding mdom_eq[OF f] mran_eq[OF f]
by auto
hence "dom f' \<subseteq> snd x" "ran f' \<subseteq> snd y"
using mfunc_snd_eq f
unfolding f_eq by auto
hence "dom f' \<subseteq> snd x \<ominus> func" "ran f' \<subseteq> snd y \<ominus> func"
using dom ran
unfolding Subset_def
exset_iff[OF mset_snd_set[OF x]]
exset_iff[OF mset_snd_set[OF y]]
exset_iff[OF tier_set[OF j]] by auto
hence "f' \<in> (snd x \<ominus> func) \<midarrow>p\<rightarrow> (snd y \<ominus> func)"
using fspaceI[OF exset_set[OF mset_snd_set[OF x]],
OF exset_set[OF mset_snd_set[OF y]], OF f']
by auto
hence "f \<in> { <func, f'> | f' \<in> (snd x \<ominus> func) \<midarrow>p\<rightarrow> (snd y \<ominus> func)}"
using repfunI[OF setof_set[OF fspace_setof],
OF exset_set[OF mset_snd_set[OF x]],
OF exset_set[OF mset_snd_set[OF y]]]
pair_smem[OF m_pair[OF mfunc_m[OF f]]]
unfolding f_eq by auto
thus "f m mfspace x y"
using mmemI msetof_mset[OF mfspace_msetof[OF x y]]
unfolding mfspace_eq[OF x y] by auto
qed
lemma mfspace_ax :
"m\<forall>x : mSet. m\<forall>y : mSet. m\<forall>f : mFunc.
(f m mfspace x y) = (mSubset (mdom f) x \<and> mSubset (mran f) y)"
unfolding mtall_def mall_def tall_def
using mfspace_iff by auto
theorem mfspace_rsp :
"x : M \<Longrightarrow> y : M \<Longrightarrow> mfspace x y : M"
using mset_m[OF msetof_mset[OF mfspace_msetof]] Function_Model_mdefault_m
unfolding mfspace_def by auto
end
end |
State Before: ⊢ toReal (-⊤) = -toReal ⊤ State After: no goals Tactic: simp State Before: ⊢ toReal (-⊥) = -toReal ⊥ State After: no goals Tactic: simp |
(* File: Elect_Module_Ref.thy
Copyright 2023 Karlsruhe Institute of Technology (KIT)
*)
\<^marker>\<open>creator "Valentin, Karlsruhe Institute of Technology (KIT)"\<close>
theory Elect_Module_Ref
imports "Verified_Voting_Rule_Construction.Elect_Module"
"Component_Types/Electoral_Module_Ref"
begin
section \<open>Refined Elect Module\<close>
text \<open>This is more or less an experimental artifacts. We use the elector instead\<close>
\<comment> \<open>The elect module should not return just the reference to all alternatives
but a deep copy.\<close>
definition aux_set_copy :: "'a set \<Rightarrow> 'a set nres" where
"aux_set_copy A \<equiv> FOREACH A
(\<lambda> x cp. RETURN (insert x cp)) {}"
lemma aux_set_copy_correct:
shows "(aux_set_copy, (RETURN o op_set_copy))
\<in> [\<lambda> s. finite s]\<^sub>f \<langle>Id\<rangle>set_rel \<rightarrow> \<langle>\<langle>Id\<rangle>set_rel\<rangle>nres_rel"
unfolding aux_set_copy_def comp_apply
apply (intro frefI nres_relI, clarsimp)
proof (rename_tac A)
fix A :: "'a set"
assume fina: "finite A"
show "FOREACH A (\<lambda>x cp. RETURN (insert x cp)) {} \<le> RETURN A"
apply (refine_vcg FOREACH_rule[where I = "\<lambda> it x.
x = A -it"])
by (auto simp add: fina)
qed
subsection \<open>Defintion\<close>
fun elect_module_ref :: "'a Electoral_Module_Ref" where
"elect_module_ref A p = do {
B \<leftarrow> aux_set_copy A;
RETURN (B,{},{})
}"
lemma elect_module_ref_correct:
shows "(uncurry elect_module_ref, uncurry (RETURN oo elect_module))
\<in> [\<lambda> (A, pl). finite A]\<^sub>f (\<langle>Id\<rangle>set_rel \<times>\<^sub>r profile_rel)
\<rightarrow> \<langle>\<langle>Id\<rangle>set_rel \<times>\<^sub>r \<langle>Id\<rangle>set_rel \<times>\<^sub>r \<langle>Id\<rangle>set_rel\<rangle>nres_rel"
unfolding elect_module_ref.simps elect_module.simps aux_set_copy_def
apply (intro frefI fun_relI nres_relI) unfolding comp_apply
apply clarsimp
proof (rename_tac A pl pr)
fix A:: "'a set"
fix pl pr
assume fina: "finite A"
from fina show "FOREACH A (\<lambda>x cp. RETURN (insert x cp)) {} \<bind> (\<lambda>B. RETURN (B, {}, {})) \<le> RETURN (A, {}, {})"
apply (refine_vcg)
apply (auto)
using aux_set_copy_correct[THEN frefD, THEN nres_relD] aux_set_copy_def
by (smt (verit, ccfv_threshold) RES_sng_eq_RETURN op_set_copy_def pair_in_Id_conv push_in_let_conv(2) refine_IdD set_rel_id_simp)
qed
sepref_definition hs_copy_sep is "aux_set_copy" ::
" (hs.assn id_assn)\<^sup>k
\<rightarrow>\<^sub>a (hs.assn id_assn)"
unfolding aux_set_copy_def hs.fold_custom_empty
by sepref
lemma hs_copy_hnr_aux: "(hs_copy_sep,RETURN o op_set_copy)
\<in> [\<lambda> s. finite s]\<^sub>a (hs.assn id_assn)\<^sup>k \<rightarrow> hs.assn id_assn"
using hs_copy_sep.refine[FCOMP aux_set_copy_correct] by auto
sepref_definition elect_module_sep is
"uncurry elect_module_ref" ::
"(alts_set_impl_assn id_assn)\<^sup>k *\<^sub>a (profile_impl_assn id_assn)\<^sup>k
\<rightarrow>\<^sub>a (result_impl_assn id_assn)"
unfolding elect_module_ref.simps aux_set_copy_def hs.fold_custom_empty
by sepref
lemma elect_module_sep_correct:
shows "(uncurry elect_module_sep, uncurry (RETURN \<circ>\<circ> elect_module)) \<in> [\<lambda>(a, b).
finite
a]\<^sub>a (alts_set_impl_assn id_assn)\<^sup>k *\<^sub>a
(list_assn
(hr_comp (ballot_impl_assn id_assn)
ballot_rel))\<^sup>k \<rightarrow> result_impl_assn id_assn"
using
elect_module_sep.refine[FCOMP elect_module_ref_correct] set_rel_id hr_comp_Id2 by simp
declare elect_module_sep_correct[sepref_fr_rules]
end |
Gods were assumed to be present throughout the world , capable of influencing natural events and the course of human lives . People interacted with them in temples and unofficial shrines , for personal reasons as well as for larger goals of state rites . Egyptians prayed for divine help , used rituals to compel deities to act , and called upon them for advice . Humans ' relations with their gods were a fundamental part of Egyptian society .
|
Online-Kurs zu Modellierung und Simulation, Goethe-Universität-Frankfurt | [Startseite](../index.ipynb)
---
# Numerische Lösung der Lotka-Volterra Gleichungen
Populationen von Beute $x$ und Räubern $y$
\begin{align}
\dot{x} & = (a-b y)x \\
\dot{y} & = -(c -dx)y\\
\end{align}
mit $a,b,c,d>0$ zum Anfangswert $(x_0, y_0)^T$.
## Lösen der DGL
Definition von Vektoren Anfangswert
$$\vec u^* = \begin{pmatrix} x^*\\ y^*\end{pmatrix} = \begin{pmatrix} c/d \\ a/b\end{pmatrix}$$
sowie für den stationären Zustand
$$\vec u_0 = \begin{pmatrix} x_0\\ y_0\end{pmatrix} = \begin{pmatrix} 0.1 \\ 1\end{pmatrix}.$$
Zudem definieren wir noch eine Koeffizientenmatrix $$\begin{pmatrix} a & b\\ c& d \end{pmatrix}.$$ Da diese in den übrigen Funktionen bekannt sein soll, verwenden wir das Schlüsselwort 'global.
```octave
u0=[0.1; 1]
global Coeff =[2 1; 3 4];
ustat = [Coeff(2,1) / Coeff(2,2); Coeff(1,1)/Coeff(1,2)];
% Bemerke: Falls ein Kommando mit Semikolon beendet wird, erfolgt keine Ausgabe.
global Coeff =[2 1; 3 4];
```
u0 =
0.10000
1.00000
Nun könnnen wir die rechte Seite der Differentialgleichung definieren.
```octave
function udot=f_lotka_volterra(u, t)
global Coeff
udot = zeros(2,1);
udot(1) = u(1)*(Coeff(1,1) - Coeff(1,2)*u(2));
udot(2) = - u(2)*(Coeff(2,1)- Coeff(2,2)*u(1));
endfunction
```
Definiere mittels `linspace` einen Vektor "times" mit 500 äquidistant verteilten Punkten im Intervall [0,20].
```octave
times = linspace(0.0, 20.0, 500);
```
Lösen der DGL mit `lsode`.
```octave
numsol = lsode (@(y,t) f_lotka_volterra(y,t), u0, times);
```
## Erzeuge einige Plots
```octave
hold on %
xlabel('Zeit t')
ylabel('Population')
plot(times, numsol(:,1), 'color', 'black')
plot(times, numsol(:,2), 'color', 'red')
```
Nun eine Darstellung von Hasen gegen Füchse.
```octave
hold on
xlabel('Hasen')
ylabel('Fuechse')
plot(numsol(:,1), numsol(:,2), 'color', 'blue')
plot(ustat(1), ustat(2), 'color', 'black')
plot(u0(1), u0(2), 'color', 'black')
```
Zuletzt das gleiche mit Vektorfeld:
```octave
% Erstelle N x N Raster
N = 17 % 17 Punkte = 16 Intervalle
xmax = max(numsol(:,1))
ymax = max(numsol(:,2))
xaxis= linspace(0.0, xmax, N);
yaxis= linspace(0.0, ymax, N);
% Initialisierung
dxRaster = zeros(N);
dyRaster = zeros(N);
% Erstelle eine Matrix mit i,j Indizierung
for i=1:length(yaxis)
for j=1:length(xaxis)
f = f_lotka_volterra([xaxis(j); yaxis(i)], 0);
dxRaster(i,j) = f(1);
dyRaster(i,j) = f(2);
end
end
% Eine weitere Lösung zum Anfangswert (0.5, 1)
numsol2 = lsode (@(y,t) f_lotka_volterra(y,4,t), [0.5; 1], times);
% Eigentlicher Plot mit quiver (s. help quiver)
hold on
xlabel('x')
ylabel('y')
title ("Richtungsfeld dy/dx ");
quiver (xaxis, yaxis, dxRaster, dyRaster);
plot(numsol(:,1), numsol(:,2), 'color', 'black')
plot(numsol2(:,1), numsol2(:,2), 'color', 'green')
plot(ustat(1), ustat(2), 'color', 'black')
```
## Bemerkung
* Hilfe zu den Befehlen erhält man mit `help`, z.B. `help plot`.
* Codezellen unterstützen <TAB>-Expansion.
* Zuletzt: Viel Freude beim Experimentieren!
```octave
help plot
```
```octave
```
```octave
```
|
```python
import numpy as np
import pandas as pd
import sympy as sm
import matplotlib.pyplot as plt
import ipywidgets as widgets
from ipywidgets import interactive, interact
from scipy import linalg
from scipy import optimize
sm.init_printing(use_unicode=True) #for pretty printing
```
```python
# Create model domain and empty array for values of K
K_size = 50
kt = np.arange(K_size)
# Parameters
alpha = 1/3
delta = 0.05
s = 0.3
B = 1
n = 0.025
# Defining CD-function
def GDP(kt):
y = B * (kt)**(alpha)
return y
# Defining equations for diagram
y = GDP(kt)
dep = (delta+n)*kt
S = s*B*kt**alpha
# Defining steady state expressions
ssk = (B**(1/(1-alpha))*(s/(n+delta))**(1/(1-alpha)))
ssy = (B**(1/(1-alpha))*(s/(n+delta))**(alpha/(1-alpha)))
# Plotting the Solow Diagram
y_max = np.max(y)
v = [0, 20, 0, 1.75]
fig, ax = plt.subplots(figsize=(10, 8))
ax.plot(kt, dep, ls = '-', label="Depreciation")
ax.plot(kt, S, ls = '-', label="Savings")
ax.set(title="Solow Model", xlabel="Capital Stock")
plt.text(18.4, 1.55, r'$ (n+\delta)k_t$')
plt.text(19,.85, r'$sBk_t^\alpha$')
plt.axvline(x = ssk, ls = "--", color = 'k', label='SS')
plt.legend(loc=2)
plt.axis(v)
plt.show()
```
<function __main__.interactive_figure(n, delta, s, alpha)>
```python
```
|
= Goals ; A =
|
State Before: C : Type u₁
inst✝² : Category C
D : Type u₂
inst✝¹ : Category D
E : Type u₃
inst✝ : Category E
e : C ≌ D
W X X' Y Y' Z : D
f : W ⟶ X
g : X ⟶ Y
h : Y ⟶ Z
f' : W ⟶ X'
g' : X' ⟶ Y'
h' : Y' ⟶ Z
⊢ f ≫ g ≫ h ≫ (counitInv e).app Z = f' ≫ g' ≫ h' ≫ (counitInv e).app Z ↔ f ≫ g ≫ h = f' ≫ g' ≫ h' State After: no goals Tactic: simp only [← Category.assoc, cancel_mono] |
% Chapter 14 - Poincare Maps and Nonautonomous Systems in the Plane.
% Programs 14a - Solving an initial value problem.
% Copyright Birkhauser 2013. Stephen Lynch.
% Solve a differential equation (Example 1).
r=dsolve('Dr=-r^2','r(0)=1');
% List the first eight returns on the segment {y=0, 0<x<1}.
% There may be small inaccuracies due to the numerical solution.
deq=inline('[-(r(1))^2]','t','r');
options=odeset('RelTol',1e-6,'AbsTol',1e-6);
[t,returns]=ode45(deq,0:2*pi:16*pi,1);
returns
% End of Programs 14a. |
Branch Metrics (branchmetrics.io) optimizes conversions and tracks installs for mobile apps. Branch makes it easy to attribute mobile installs down to every user and complete the install attribution loop. We also help create a white-labeled, shareable URL for every shared piece of content (e.g. reports in ExpenseIt or locations in TripIt) or referral that someone shares from your app or site. The problem with mobile installs is that attribution and tracking is a black box and shared URLs link to the content ONLY if the receiver already had the app installed. The Branch SDK fixes those problems by letting you deep link to content across install, attribute every install, and personalize every on-boarding easily and seamlessly. |
module Circuits.NetList.Linear.Usage.DataType.Use.Full
import Decidable.Equality
import Data.Nat
import Data.List.Elem
import Data.List.Quantifiers
import Data.Vect
import Data.Vect.AtIndex
import Data.Vect.Quantifiers
import Data.String
import Toolkit.Data.Whole
import Toolkit.Data.DList
import Toolkit.Data.DList.Elem
import Toolkit.Data.Vect.Extra
import Circuits.Common
import Circuits.NetList.Types
import Circuits.NetList.Linear.Usage.DataType
%default total
mutual
public export
data Use : (type : DType)
-> (free : Usage type)
-> (this : IsFree type free)
-> (used : Usage type)
-> (that : IsUsed type used)
-> Type
where
UFL : Use LOGIC (Logic FREE) FreeL
(Logic USED) UsedL
UFA : (prf : Use type fs free us used)
-> Use (BVECT (W (S n) ItIsSucc) type) (Array fs) (FreeA free)
(Array us) (UsedA used)
public export
data Result : (type : DType)
-> (free : Usage type)
-> (prf : IsFree type free)
-> Type
where
R : (u : Usage type)
-> (used : IsUsed type u)
-> (result : Use type f free u used)
-> Result type f free
namespace Vect
public export
data Use : (type : DType)
-> (this : Vect n (Usage type))
-> (free : All (IsFree type) this)
-> (that : Vect n (Usage type))
-> (used : All (IsUsed type) that)
-> Type
where
End : Use type Nil Nil Nil Nil
Ext : Use type f pf u pu
-> Use type fs pfs us pus
-> Use type (f::fs) (pf::pfs) (u::us) (pu::pus)
public export
data Result : (type : DType)
-> (free : Vect n (Usage type))
-> (prf : All (IsFree type) free)
-> Type
where
R : {this : Vect n (Usage type)}
-> (free : All (IsFree type) this)
-> (us : Vect n (Usage type))
-> (useds : All (IsUsed type) us)
-> (results : Use type this free us useds)
-> Result type this free
mutual
export
use : {type : DType}
-> {free : Usage type}
-> (prf : IsFree type free)
-> Result type free prf
use FreeL
= R (Logic USED) UsedL UFL
use (FreeA prf) with (use prf)
use (FreeA prf) | (R prf us useds results)
= R (Array us) (UsedA useds) (UFA results)
namespace Vect
export
use : {type : DType}
-> {free : Vect n (Usage type)}
-> (prf : All (IsFree type) free)
-> Result type free prf
use []
= R [] [] [] End
use (x :: xs) with (use x)
use (x :: xs) | (R u used result) with (use xs)
use (x :: xs) | (R u used result) | (R xs us useds results)
= R (x :: xs) (u :: us) (used :: useds) (Ext result results)
-- [ EOF ]
|
sine1_3D_lc = environment_3D(x -> sin(x[1]) + sin(x[2]))
sine2_3D_lc = environment_3D(x -> 0.075 * sin(2π * x[1]))
sine3_3D_lc = environment_3D(x -> 0.075 * sin(2π * x[1]) * sin(2π * x[2]))
sine1_2D_lc = environment_2D(x -> 0.05 * (cos(pi * x[1]) - 1.0))
sine2_2D_lc = environment_2D(x -> 0.10 * sin(2π * x[1]))
sine3_2D_lc = environment_2D(x -> 0.03 * (cos(pi * x[1]) - 1.0))
|
module Cats.Limit.Product where
open import Data.Bool using (Bool ; true ; false)
open import Data.Product using (_×_ ; _,_ ; ∃-syntax ; proj₁ ; proj₂)
open import Cats.Category
open import Cats.Category.Cones using (Cones ; Cone ; HasObj-Cone)
open import Cats.Category.Discrete as Discrete using (Discrete)
open import Cats.Functor using (Functor)
open import Cats.Limit
open import Cats.Util.Conv
module _ {lo la l≈ li}
{Cat : Category lo la l≈}
{I : Set li} {O : I → Category.Obj Cat}
where
open Category Cat
open Product using (isProduct)
open Cone using (arr)
F : Functor (Discrete I) Cat
F = Discrete.functor I O
private
module Cones = Category (Cones F)
productData→cone : ∀ {P} → (∀ i → P ⇒ O i) → Cone F
productData→cone {P} proj = record
{ Apex = P
; arr = proj
; commute = λ { Discrete.id → ≈.sym id-l }
}
cone→productData : Cone F → ∃[ P ] (∀ i → P ⇒ O i)
cone→productData c = c ᴼ , arr c
terminal : ∀ {P} {proj : ∀ i → P ⇒ O i}
→ IsProduct O P proj
→ Cones.IsTerminal (productData→cone proj)
terminal {P} {proj} isProduct c = record
{ arr = record
{ θ = θ
; commute = commute
}
; unique = λ where
{record { θ = θ′ ; commute = commute′ }} _ →
∃!′.unique prod (λ i → ≈.sym (commute′ i))
}
where
prod : ∃![ u ] (∀ i → arr c i ≈ proj i ∘ u)
prod = isProduct (arr c)
θ : c ᴼ ⇒ P
θ = prod ⃗
commute : ∀ j → arr (productData→cone proj) j ∘ θ ≈ arr c j
commute j = ≈.sym (∃!′.prop prod j)
product : ∀ {c}
→ Cones.IsTerminal c
→ let (P , proj) = cone→productData c
in IsProduct O P proj
product {c} term {X} x = record
{ arr = f
; prop = prop
; unique = uniq
}
where
open Cats.Category.Cones._⇒_ using (θ ; commute)
P = proj₁ (cone→productData c)
proj = proj₂ (cone→productData c)
u : Cones.∃! (productData→cone x) c
u = term (productData→cone x)
f : X ⇒ P
f = θ (u ⃗)
prop : ∀ i → x i ≈ proj i ∘ f
prop i = ≈.sym (commute (u ⃗) _)
uniq : IsUniqueSuchThat (λ g → ∀ i → x i ≈ proj i ∘ g) f
uniq {g} eq = Cones.∃!′.unique u {f′} _
where
f′ : productData→cone x Cones.⇒ c
f′ = record
{ θ = g
; commute = λ i → ≈.sym (eq i)
}
product→limit : Product O → Limit F
product→limit P = record
{ cone = productData→cone (Product.proj P)
; isLimit = terminal (isProduct P)
}
limit→product : Limit F → Product O
limit→product L
= let (P , proj) = cone→productData (L ᴼ) in
record
{ prod = P
; proj = proj
; isProduct = product (Limit.isLimit L)
}
product-unique : (P Q : Product O) → P ᴼ ≅ Q ᴼ
product-unique P Q = obj-unique (product→limit P) (product→limit Q)
|
Require Import Coq.omega.Omega.
Require Import Bedrock.Examples.AutoSep.
Require Import Coq.Arith.Arith Coq.Lists.List.
Set Implicit Arguments.
Local Hint Extern 1 (himp _ (allocated _ _ _) (allocated _ _ _)) => apply allocated_shift_base.
Lemma wplus_lt_lift : forall n m o : nat,
goodSize (n + m)
-> goodSize o
-> natToW n ^+ natToW m < natToW o
-> (n + m < o)%nat.
unfold wlt; intros.
rewrite <- natToWord_plus in H1.
unfold wplusN, wordBinN in *.
repeat rewrite wordToN_nat in *.
repeat rewrite wordToNat_natToW_goodSize in * by auto.
nomega.
Qed.
Local Hint Extern 1 (_ <= _)%nat => match goal with
| [ H : _ < _ |- _ ] =>
apply wplus_lt_lift in H;
[ omega | solve [ eauto ] | solve [ eauto ] ]
end.
Lemma goodSize_plus2 : forall n,
goodSize (n + 2)
-> goodSize n.
intros; eapply goodSize_plus_l; eauto.
Qed.
Lemma goodSize_diff : forall x y,
goodSize (x + 2)
-> goodSize (x - y - 2 + 2).
intros; eapply goodSize_weaken; eauto.
Qed.
Local Hint Resolve goodSize_plus2 goodSize_diff.
(** * A free-list heap managed by the malloc library *)
Module Type FREE_LIST.
Parameter freeable : W -> nat -> Prop.
Axiom goodSize_freeable : forall p sz,
freeable p sz
-> goodSize sz.
Axiom freeable_narrow : forall a sz sz',
freeable a sz
-> (sz' <= sz)%nat
-> freeable a sz'.
Axiom freeable_split : forall a b x y,
freeable a (x + 2)
-> natToW (y + 2) < natToW x
-> goodSize (y + 2)
-> b = a ^+ $4 ^* (natToW x ^- natToW y)
-> freeable b (y + 2).
Axiom it's_not_zero : forall x y a b,
x = y ^+ $4 ^* ($ (a) ^- natToW b)
-> freeable y (a + 2)
-> natToW (b + 2) < natToW a
-> goodSize (b + 2)
-> x <> $0.
Parameter freeList : nat (* number of elements in list *) -> W -> HProp.
Parameter mallocHeap : HProp.
Axiom freeList_extensional : forall n p, HProp_extensional (freeList n p).
Axiom mallocHeap_extensional : HProp_extensional mallocHeap.
Axiom mallocHeap_fwd : mallocHeap ===> Ex n, Ex p, 0 =*> p * freeList n p.
Axiom mallocHeap_bwd : (Ex n, Ex p, 0 =*> p * freeList n p) ===> mallocHeap.
Axiom nil_bwd : forall n p, p = 0 -> [| n = 0 |] ===> freeList n p.
Axiom cons_bwd : forall n (p : W), p <> 0
-> (Ex n', Ex sz, Ex p', [| n = S n' /\ freeable p (sz+2) |] * (p ==*> $ (sz), p')
* (p ^+ $8) =?> sz * freeList n' p')
===> freeList n p.
Axiom cons_fwd : forall n (p : W), p <> 0
-> freeList n p
===> Ex n', Ex sz, Ex p', [| n = S n' /\ freeable p (sz+2) |] * (p ==*> $ (sz), p')
* (p ^+ $8) =?> sz * freeList n' p'.
End FREE_LIST.
Module FreeList : FREE_LIST.
Transparent goodSize.
Definition noWrapAround (p : W) (sz : nat) :=
forall n, (n < sz * 4)%nat -> p ^+ $ (n) <> $0.
Definition freeable (p : W) (sz : nat) := goodSize sz /\ noWrapAround p sz.
Lemma goodSize_narrow : forall sz sz' q,
(N.of_nat sz < q)%N
-> (sz' <= sz)%nat
-> (N.of_nat sz' < q)%N.
intros; nomega.
Qed.
Lemma freeable_narrow : forall a sz sz',
freeable a sz
-> (sz' <= sz)%nat
-> freeable a sz'.
unfold freeable; intuition eauto.
eapply goodSize_narrow; eauto.
do 2 intro.
apply H2.
omega.
Qed.
Lemma goodSize_freeable : forall p sz,
freeable p sz
-> goodSize sz.
unfold freeable; tauto.
Qed.
Lemma it's_not_zero : forall x y a b,
x = y ^+ $4 ^* ($ (a) ^- natToW b)
-> freeable y (a + 2)
-> natToW (b + 2) < natToW a
-> goodSize (b + 2)
-> x <> $0.
intros.
destruct H0.
intro.
apply (H3 (4 * (a - b))).
auto.
rewrite mult_comm.
rewrite natToW_times4.
rewrite natToW_minus.
rewrite wmult_comm.
subst; assumption.
apply lt_goodSize' in H1; auto.
Qed.
Hint Extern 1 (_ < _)%N => apply goodSize_plus2.
Lemma freeable_split : forall a b x y,
freeable a (x + 2)
-> natToW (y + 2) < natToW x
-> goodSize (y + 2)
-> b = a ^+ $4 ^* (natToW x ^- natToW y)
-> freeable b (y + 2).
intros; rewrite natToW_plus in *.
destruct H; split; auto; subst.
do 2 intro.
specialize (H3 (4 * (x - y) + n)).
intro.
apply H3.
auto.
rewrite natToW_plus.
rewrite mult_comm.
rewrite natToW_times4.
rewrite natToW_minus.
rewrite wmult_comm.
rewrite wplus_assoc.
assumption.
auto.
Qed.
Open Scope Sep_scope.
Fixpoint freeList (n : nat) (p : W) : HProp :=
match n with
| O => [| p = 0 |]
| S n' => [| p <> 0 |] * Ex sz, Ex p', [| freeable p (sz+2) |] * (p ==*> $ (sz), p')
* (p ^+ $8) =?> sz * freeList n' p'
end.
Definition mallocHeap := Ex n, Ex p, 0 =*> p * freeList n p.
Theorem freeList_extensional : forall n p, HProp_extensional (freeList n p).
destruct n; reflexivity.
Qed.
Theorem mallocHeap_extensional : HProp_extensional mallocHeap.
reflexivity.
Qed.
Theorem mallocHeap_fwd : mallocHeap ===> Ex n, Ex p, 0 =*> p * freeList n p.
unfold mallocHeap; sepLemma.
Qed.
Theorem mallocHeap_bwd : (Ex n, Ex p, 0 =*> p * freeList n p) ===> mallocHeap.
unfold mallocHeap; sepLemma.
Qed.
Theorem nil_bwd : forall n p, p = 0 -> [| n = 0 |] ===> freeList n p.
destruct n; sepLemma.
Qed.
Theorem cons_bwd : forall n (p : W), p <> 0
-> (Ex n', Ex sz, Ex p', [| n = S n' /\ freeable p (sz+2) |] * (p ==*> $ (sz), p')
* (p ^+ $8) =?> sz * freeList n' p')
===> freeList n p.
destruct n; sepLemma; match goal with
| [ H : S _ = S _ |- _ ] => injection H
end; sepLemma.
Qed.
Theorem cons_fwd : forall n (p : W), p <> 0
-> freeList n p
===> Ex n', Ex sz, Ex p', [| n = S n' /\ freeable p (sz+2) |] * (p ==*> $ (sz), p')
* (p ^+ $8) =?> sz * freeList n' p'.
destruct n; sepLemma.
Qed.
End FreeList.
Import FreeList.
Export FreeList.
Hint Immediate freeList_extensional mallocHeap_extensional.
Definition splitMe cur full (_ : nat) := (cur =?> full)%Sep.
Local Hint Resolve goodSize_freeable.
Lemma malloc_split : forall cur full init,
(init <= full)%nat
-> splitMe cur full init ===> cur =?> init
* (cur ^+ $ (init * 4)) =?> (full - init).
intros; eapply Himp_trans; [
eapply allocated_split; eauto
| sepLemma; apply allocated_shift_base; [
rewrite mult_comm; simpl; unfold natToW; W_eq
| reflexivity ] ].
Qed.
(*TIME Clear Timing Profile. *)
Definition hints : TacPackage.
(*TIME idtac "malloc:prepare". Time *)
prepare (mallocHeap_fwd, cons_fwd, malloc_split) (mallocHeap_bwd, nil_bwd, cons_bwd).
(*TIME Time *)Defined.
Definition initS : spec := SPEC("size") reserving 0
Al n,
PRE[V] [| V("size") = $ (n) |] * [| freeable 4 (n+2) |] * 0 =?> (3 + n)
POST[_] mallocHeap.
Definition freeS : spec := SPEC("p", "n") reserving 1
Al n,
PRE[V] [| V "n" = $ (n) |] * [| V "p" <> 0 |] * [| freeable (V "p") (n+2) |] * V "p" =?> (2 + n) * mallocHeap
POST[_] mallocHeap.
Definition mallocS : spec := SPEC("n") reserving 4
Al sz,
PRE[V] [| V "n" = $ (sz) |] * [| goodSize (sz+2) |] * mallocHeap
POST[R] [| R <> 0 |] * [| freeable R (sz+2) |] * R =?> (sz + 2) * mallocHeap.
Definition mallocM := bmodule "malloc" {{
bfunction "init"("size") [initS]
0 *<- 4;;
4 *<- "size";;
8 *<- 0;;
Return 0
end with bfunction "free"("p", "n", "tmp") [freeS]
"p" *<- "n";;
"tmp" <-* 0;;
0 *<- "p";;
"p" <- "p" + 4;;
"p" *<- "tmp";;
Return 0
end with bfunction "malloc"("n", "cur", "prev", "tmp", "tmp2") [mallocS]
"cur" <-* 0;;
"prev" <- 0;;
[Al sz, Al len,
PRE[V] [| V "n" = $ (sz) |] * [| goodSize (sz+2) |] * V "prev" =*> V "cur" * freeList len (V "cur")
POST[R] Ex p, Ex len', [| R <> 0 |] * [| freeable R (sz+2) |] * R =?> (sz + 2)
* V "prev" =*> p * freeList len' p]
While ("cur" <> 0) {
"tmp" <-* "cur";;
If ("tmp" = "n") {
(* Exact size match on the current free list block *)
"tmp" <- "cur" + 4;;
"tmp" <-* "tmp";;
"prev" *<- "tmp";;
Return "cur"
} else {
"tmp" <- "n" + 2;;
"tmp2" <-* "cur";;
If ("tmp" < "tmp2") {
(* This free list block is large enough to split in two. *)
(* Calculate starting address of a suffix of this free block to return to caller. *)
"tmp" <- "tmp2" - "n";;
"tmp" <- 4 * "tmp";;
"tmp" <- "cur" + "tmp";;
(* Decrement size of free list block to reflect deleted suffix. *)
"tmp2" <- "tmp2" - "n";;
"tmp2" <- "tmp2" - 2;;
"cur" *<- "tmp2";;
(* Return suffix starting address. *)
Return "tmp"
} else {
(* Current block too small; continue to next. *)
"prev" <- "cur" + 4;;
"cur" <-* "prev"
}
}
};;
Diverge (* out of memory! *)
end
}}.
Lemma four_neq_zero : natToW 4 <> natToW 0.
discriminate.
Qed.
Lemma cancel8 : forall x y z,
(z + 2 <= y)%nat
-> x ^+ $8 ^+ ($ (y) ^- $ (z + 2)) ^* $4 = x ^+ $4 ^* ($ (y) ^- natToW z).
intros.
autorewrite with sepFormula.
rewrite natToW_plus.
unfold natToW.
W_eq.
Qed.
Local Hint Extern 1 False => eapply it's_not_zero; eassumption.
Local Hint Extern 1 (freeable _ _) => eapply freeable_narrow; [ eassumption | omega ].
Local Hint Extern 1 (freeable _ _) => eapply freeable_split; eassumption.
Local Hint Extern 1 (@eq (word _) _ _) => words.
Local Hint Extern 5 (@eq nat _ _) => omega.
Local Hint Extern 5 (_ <= _)%nat => omega.
Section mallocOk.
Hint Rewrite natToW_times4 cancel8 natToW_minus using solve [ auto ] : sepFormula.
Ltac main := generalize four_neq_zero; sep hints;
try match goal with
| [ H1 : _ = ?X, H2 : ?X = _ |- _ ] =>
rewrite H2 in H1;
apply natToW_inj in H1; [ | solve [ eauto ] | solve [ eauto ] ];
subst
end; congruence || eauto; try rewrite <- (plus_comm 2);
simpl; cancel hints.
Ltac split_case := post; evaluate hints;
match goal with
| [ H : sel _ _ = natToW _ |- _ ] => rewrite H in *
end;
match goal with
| [ _ : natToW ?init ^+ natToW 2 < natToW ?full,
H : context[((?base ^+ natToW 8) =?> ?full)%Sep],
H' : freeable _ (?full + 2) |- _ ] =>
change ((base ^+ natToW 8) =?> full)%Sep
with (splitMe (base ^+ natToW 8) full (full - init - 2)) in H;
assert (full - init - 2 <= full)%nat by omega
end; sep hints;
try match goal with
| [ H : natToW (?a + ?b) < natToW ?c |- _ ] =>
rewrite natToW_plus in H;
apply wplus_lt_lift in H; [ | solve [ eauto ] | solve [ eauto ] ]
end; sep hints; auto.
Ltac combined :=
match goal with
| [ |- context[Times] ] =>
match goal with
| [ |- context[Logic.ex _] ] => split_case
end
| _ => main
end.
Theorem mallocMOk : moduleOk mallocM.
(*TIME idtac "malloc:verify". Time *)
vcgen; abstract combined.
(*TIME Time *)Qed.
(*TIME Print Timing Profile. *)
End mallocOk.
|
[STATEMENT]
lemma propositions[PLM]:
"[\<^bold>\<exists> p . \<^bold>\<box>(p \<^bold>\<equiv> p') in v]"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. [\<^bold>\<exists>p. \<^bold>\<box>(p \<^bold>\<equiv> p') in v]
[PROOF STEP]
by PLM_solver |
/-
Copyright (c) 2019 Kevin Kappelmann. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kevin Kappelmann
-/
import data.seq.seq
import algebra.field.basic
/-!
# Basic Definitions/Theorems for Continued Fractions
## Summary
We define generalised, simple, and regular continued fractions and functions to evaluate their
convergents. We follow the naming conventions from Wikipedia and [wall2018analytic], Chapter 1.
## Main definitions
1. Generalised continued fractions (gcfs)
2. Simple continued fractions (scfs)
3. (Regular) continued fractions ((r)cfs)
4. Computation of convergents using the recurrence relation in `convergents`.
5. Computation of convergents by directly evaluating the fraction described by the gcf in
`convergents'`.
## Implementation notes
1. The most commonly used kind of continued fractions in the literature are regular continued
fractions. We hence just call them `continued_fractions` in the library.
2. We use sequences from `data.seq` to encode potentially infinite sequences.
## References
- <https://en.wikipedia.org/wiki/Generalized_continued_fraction>
- [Wall, H.S., *Analytic Theory of Continued Fractions*][wall2018analytic]
## Tags
numerics, number theory, approximations, fractions
-/
-- Fix a carrier `α`.
variable (α : Type*)
/-!### Definitions-/
/-- We collect a partial numerator `aᵢ` and partial denominator `bᵢ` in a pair `⟨aᵢ,bᵢ⟩`. -/
@[derive inhabited]
protected structure generalized_continued_fraction.pair := (a : α) (b : α)
open generalized_continued_fraction
/-! Interlude: define some expected coercions and instances. -/
namespace generalized_continued_fraction.pair
variable {α}
/-- Make a `gcf.pair` printable. -/
instance [has_repr α] : has_repr (pair α) :=
⟨λ p, "(a : " ++ (repr p.a) ++ ", b : " ++ (repr p.b) ++ ")"⟩
/-- Maps a function `f` on both components of a given pair. -/
def map {β : Type*} (f : α → β) (gp : pair α) : pair β :=
⟨f gp.a, f gp.b⟩
section coe
/- Fix another type `β` which we will convert to. -/
variables {β : Type*} [has_coe α β]
/-- Coerce a pair by elementwise coercion. -/
instance has_coe_to_generalized_continued_fraction_pair : has_coe (pair α) (pair β) :=
⟨map coe⟩
@[simp, norm_cast]
end coe
end generalized_continued_fraction.pair
variable (α)
/--
A *generalised continued fraction* (gcf) is a potentially infinite expression of the form
a₀
h + ---------------------------
a₁
b₀ + --------------------
a₂
b₁ + --------------
a₃
b₂ + --------
b₃ + ...
where `h` is called the *head term* or *integer part*, the `aᵢ` are called the
*partial numerators* and the `bᵢ` the *partial denominators* of the gcf.
We store the sequence of partial numerators and denominators in a sequence of
generalized_continued_fraction.pairs `s`.
For convenience, one often writes `[h; (a₀, b₀), (a₁, b₁), (a₂, b₂),...]`.
-/
structure generalized_continued_fraction :=
(h : α) (s : seq $ pair α)
variable {α}
namespace generalized_continued_fraction
/-- Constructs a generalized continued fraction without fractional part. -/
def of_integer (a : α) : generalized_continued_fraction α :=
⟨a, seq.nil⟩
instance [inhabited α] : inhabited (generalized_continued_fraction α) := ⟨of_integer (default _)⟩
/-- Returns the sequence of partial numerators `aᵢ` of `g`. -/
def partial_numerators (g : generalized_continued_fraction α) : seq α :=
g.s.map pair.a
/-- Returns the sequence of partial denominators `bᵢ` of `g`. -/
def partial_denominators (g : generalized_continued_fraction α) : seq α :=
g.s.map pair.b
/-- A gcf terminated at position `n` if its sequence terminates at position `n`. -/
def terminated_at (g : generalized_continued_fraction α) (n : ℕ) : Prop := g.s.terminated_at n
/-- It is decidable whether a gcf terminated at a given position. -/
instance terminated_at_decidable (g : generalized_continued_fraction α) (n : ℕ) :
decidable (g.terminated_at n) :=
by { unfold terminated_at, apply_instance }
/-- A gcf terminates if its sequence terminates. -/
def terminates (g : generalized_continued_fraction α) : Prop := g.s.terminates
section coe
/-! Interlude: define some expected coercions. -/
/- Fix another type `β` which we will convert to. -/
variables {β : Type*} [has_coe α β]
/-- Coerce a gcf by elementwise coercion. -/
instance has_coe_to_generalized_continued_fraction :
has_coe (generalized_continued_fraction α) (generalized_continued_fraction β) :=
⟨λ g, ⟨(g.h : β), (g.s.map coe : seq $ pair β)⟩⟩
@[simp, norm_cast]
lemma coe_to_generalized_continued_fraction {g : generalized_continued_fraction α} :
(↑(g : generalized_continued_fraction α) : generalized_continued_fraction β) =
⟨(g.h : β), (g.s.map coe : seq $ pair β)⟩ :=
rfl
end coe
end generalized_continued_fraction
/--
A generalized continued fraction is a *simple continued fraction* if all partial numerators are
equal to one.
1
h + ---------------------------
1
b₀ + --------------------
1
b₁ + --------------
1
b₂ + --------
b₃ + ...
-/
def generalized_continued_fraction.is_simple_continued_fraction
(g : generalized_continued_fraction α) [has_one α] : Prop :=
∀ (n : ℕ) (aₙ : α), g.partial_numerators.nth n = some aₙ → aₙ = 1
variable (α)
/--
A *simple continued fraction* (scf) is a generalized continued fraction (gcf) whose partial
numerators are equal to one.
1
h + ---------------------------
1
b₀ + --------------------
1
b₁ + --------------
1
b₂ + --------
b₃ + ...
For convenience, one often writes `[h; b₀, b₁, b₂,...]`.
It is encoded as the subtype of gcfs that satisfy
`generalized_continued_fraction.is_simple_continued_fraction`.
-/
def simple_continued_fraction [has_one α] :=
{g : generalized_continued_fraction α // g.is_simple_continued_fraction}
variable {α}
/- Interlude: define some expected coercions. -/
namespace simple_continued_fraction
variable [has_one α]
/-- Constructs a simple continued fraction without fractional part. -/
def of_integer (a : α) : simple_continued_fraction α :=
⟨generalized_continued_fraction.of_integer a, λ n aₙ h, by cases h⟩
instance : inhabited (simple_continued_fraction α) := ⟨of_integer 1⟩
/-- Lift a scf to a gcf using the inclusion map. -/
instance has_coe_to_generalized_continued_fraction :
has_coe (simple_continued_fraction α) (generalized_continued_fraction α) :=
by {unfold simple_continued_fraction, apply_instance}
lemma coe_to_generalized_continued_fraction {s : simple_continued_fraction α} :
(↑s : generalized_continued_fraction α) = s.val := rfl
end simple_continued_fraction
/--
A simple continued fraction is a *(regular) continued fraction* ((r)cf) if all partial denominators
`bᵢ` are positive, i.e. `0 < bᵢ`.
-/
def simple_continued_fraction.is_continued_fraction [has_one α] [has_zero α] [has_lt α]
(s : simple_continued_fraction α) : Prop :=
∀ (n : ℕ) (bₙ : α),
(↑s : generalized_continued_fraction α).partial_denominators.nth n = some bₙ → 0 < bₙ
variable (α)
/--
A *(regular) continued fraction* ((r)cf) is a simple continued fraction (scf) whose partial
denominators are all positive. It is the subtype of scfs that satisfy
`simple_continued_fraction.is_continued_fraction`.
-/
def continued_fraction [has_one α] [has_zero α] [has_lt α] :=
{s : simple_continued_fraction α // s.is_continued_fraction}
variable {α}
/-! Interlude: define some expected coercions. -/
namespace continued_fraction
variables [has_one α] [has_zero α] [has_lt α]
/-- Constructs a continued fraction without fractional part. -/
def of_integer (a : α) : continued_fraction α :=
⟨simple_continued_fraction.of_integer a, λ n bₙ h, by cases h⟩
instance : inhabited (continued_fraction α) := ⟨of_integer 0⟩
/-- Lift a cf to a scf using the inclusion map. -/
instance has_coe_to_simple_continued_fraction :
has_coe (continued_fraction α) (simple_continued_fraction α) :=
by {unfold continued_fraction, apply_instance}
lemma coe_to_simple_continued_fraction {c : continued_fraction α} :
(↑c : simple_continued_fraction α) = c.val := rfl
/-- Lift a cf to a scf using the inclusion map. -/
instance has_coe_to_generalized_continued_fraction :
has_coe (continued_fraction α) (generalized_continued_fraction α) :=
⟨λ c, ↑(↑c : simple_continued_fraction α)⟩
lemma coe_to_generalized_continued_fraction {c : continued_fraction α} :
(↑c : generalized_continued_fraction α) = c.val := rfl
end continued_fraction
namespace generalized_continued_fraction
/-!
### Computation of Convergents
We now define how to compute the convergents of a gcf. There are two standard ways to do this:
directly evaluating the (infinite) fraction described by the gcf or using a recurrence relation.
For (r)cfs, these computations are equivalent as shown in
`algebra.continued_fractions.convergents_equiv`.
-/
-- Fix a division ring for the computations.
variables {K : Type*} [division_ring K]
/-!
We start with the definition of the recurrence relation. Given a gcf `g`, for all `n ≥ 1`, we define
- `A₋₁ = 1, A₀ = h, Aₙ = bₙ₋₁ * Aₙ₋₁ + aₙ₋₁ * Aₙ₋₂`, and
- `B₋₁ = 0, B₀ = 1, Bₙ = bₙ₋₁ * Bₙ₋₁ + aₙ₋₁ * Bₙ₋₂`.
`Aₙ, `Bₙ` are called the *nth continuants*, Aₙ the *nth numerator*, and `Bₙ` the
*nth denominator* of `g`. The *nth convergent* of `g` is given by `Aₙ / Bₙ`.
-/
/--
Returns the next numerator `Aₙ = bₙ₋₁ * Aₙ₋₁ + aₙ₋₁ * Aₙ₋₂`, where `predA` is `Aₙ₋₁`,
`ppredA` is `Aₙ₋₂`, `a` is `aₙ₋₁`, and `b` is `bₙ₋₁`.
-/
def next_numerator (a b ppredA predA : K) : K := b * predA + a * ppredA
/--
Returns the next denominator `Bₙ = bₙ₋₁ * Bₙ₋₁ + aₙ₋₁ * Bₙ₋₂``, where `predB` is `Bₙ₋₁` and
`ppredB` is `Bₙ₋₂`, `a` is `aₙ₋₁`, and `b` is `bₙ₋₁`.
-/
def next_denominator (aₙ bₙ ppredB predB : K) : K := bₙ * predB + aₙ * ppredB
/--
Returns the next continuants `⟨Aₙ, Bₙ⟩` using `next_numerator` and `next_denominator`, where `pred`
is `⟨Aₙ₋₁, Bₙ₋₁⟩`, `ppred` is `⟨Aₙ₋₂, Bₙ₋₂⟩`, `a` is `aₙ₋₁`, and `b` is `bₙ₋₁`.
-/
def next_continuants (a b : K) (ppred pred : pair K) : pair K :=
⟨next_numerator a b ppred.a pred.a, next_denominator a b ppred.b pred.b⟩
/-- Returns the continuants `⟨Aₙ₋₁, Bₙ₋₁⟩` of `g`. -/
def continuants_aux (g : generalized_continued_fraction K) : stream (pair K)
| 0 := ⟨1, 0⟩
| 1 := ⟨g.h, 1⟩
| (n + 2) :=
match g.s.nth n with
| none := continuants_aux (n + 1)
| some gp := next_continuants gp.a gp.b (continuants_aux n) (continuants_aux $ n + 1)
end
/-- Returns the continuants `⟨Aₙ, Bₙ⟩` of `g`. -/
def continuants (g : generalized_continued_fraction K) : stream (pair K) :=
g.continuants_aux.tail
/-- Returns the numerators `Aₙ` of `g`. -/
def numerators (g : generalized_continued_fraction K) : stream K :=
g.continuants.map pair.a
/-- Returns the denominators `Bₙ` of `g`. -/
def denominators (g : generalized_continued_fraction K) : stream K :=
g.continuants.map pair.b
/-- Returns the convergents `Aₙ / Bₙ` of `g`, where `Aₙ, Bₙ` are the nth continuants of `g`. -/
def convergents (g : generalized_continued_fraction K) : stream K :=
λ (n : ℕ), (g.numerators n) / (g.denominators n)
/--
Returns the approximation of the fraction described by the given sequence up to a given position n.
For example, `convergents'_aux [(1, 2), (3, 4), (5, 6)] 2 = 1 / (2 + 3 / 4)` and
`convergents'_aux [(1, 2), (3, 4), (5, 6)] 0 = 0`.
-/
def convergents'_aux : seq (pair K) → ℕ → K
| s 0 := 0
| s (n + 1) := match s.head with
| none := 0
| some gp := gp.a / (gp.b + convergents'_aux s.tail n)
end
/--
Returns the convergents of `g` by evaluating the fraction described by `g` up to a given
position `n`. For example, `convergents' [9; (1, 2), (3, 4), (5, 6)] 2 = 9 + 1 / (2 + 3 / 4)` and
`convergents' [9; (1, 2), (3, 4), (5, 6)] 0 = 9`
-/
def convergents' (g : generalized_continued_fraction K) (n : ℕ) : K := g.h + convergents'_aux g.s n
end generalized_continued_fraction
-- Now, some basic, general theorems
namespace generalized_continued_fraction
/-- Two gcfs `g` and `g'` are equal if and only if their components are equal. -/
protected lemma ext_iff {g g' : generalized_continued_fraction α} :
g = g' ↔ g.h = g'.h ∧ g.s = g'.s :=
by { cases g, cases g', simp }
@[ext]
protected lemma ext {g g' : generalized_continued_fraction α} (hyp : g.h = g'.h ∧ g.s = g'.s) :
g = g' :=
generalized_continued_fraction.ext_iff.elim_right hyp
end generalized_continued_fraction
|
State Before: R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : PowerSeries R
⊢ min (order φ) (order ψ) ≤ order (φ + ψ) State After: R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : PowerSeries R
⊢ ∀ (i : ℕ), ↑i < min (order φ) (order ψ) → ↑(coeff R i) (φ + ψ) = 0 Tactic: refine' le_order _ _ _ State Before: R : Type u_1
inst✝ : Semiring R
φ✝ φ ψ : PowerSeries R
⊢ ∀ (i : ℕ), ↑i < min (order φ) (order ψ) → ↑(coeff R i) (φ + ψ) = 0 State After: no goals Tactic: simp (config := { contextual := true }) [coeff_of_lt_order] |
%noinline %inline
foo : Int -> Int
foo x = x
|
(*<*)theory CTLind imports CTL begin(*>*)
subsection\<open>CTL Revisited\<close>
text\<open>\label{sec:CTL-revisited}
\index{CTL|(}%
The purpose of this section is twofold: to demonstrate
some of the induction principles and heuristics discussed above and to
show how inductive definitions can simplify proofs.
In \S\ref{sec:CTL} we gave a fairly involved proof of the correctness of a
model checker for CTL\@. In particular the proof of the
@{thm[source]infinity_lemma} on the way to @{thm[source]AF_lemma2} is not as
simple as one might expect, due to the \<open>SOME\<close> operator
involved. Below we give a simpler proof of @{thm[source]AF_lemma2}
based on an auxiliary inductive definition.
Let us call a (finite or infinite) path \emph{\<^term>\<open>A\<close>-avoiding} if it does
not touch any node in the set \<^term>\<open>A\<close>. Then @{thm[source]AF_lemma2} says
that if no infinite path from some state \<^term>\<open>s\<close> is \<^term>\<open>A\<close>-avoiding,
then \<^prop>\<open>s \<in> lfp(af A)\<close>. We prove this by inductively defining the set
\<^term>\<open>Avoid s A\<close> of states reachable from \<^term>\<open>s\<close> by a finite \<^term>\<open>A\<close>-avoiding path:
% Second proof of opposite direction, directly by well-founded induction
% on the initial segment of M that avoids A.
\<close>
inductive_set
Avoid :: "state \<Rightarrow> state set \<Rightarrow> state set"
for s :: state and A :: "state set"
where
"s \<in> Avoid s A"
| "\<lbrakk> t \<in> Avoid s A; t \<notin> A; (t,u) \<in> M \<rbrakk> \<Longrightarrow> u \<in> Avoid s A"
text\<open>
It is easy to see that for any infinite \<^term>\<open>A\<close>-avoiding path \<^term>\<open>f\<close>
with \<^prop>\<open>f(0::nat) \<in> Avoid s A\<close> there is an infinite \<^term>\<open>A\<close>-avoiding path
starting with \<^term>\<open>s\<close> because (by definition of \<^const>\<open>Avoid\<close>) there is a
finite \<^term>\<open>A\<close>-avoiding path from \<^term>\<open>s\<close> to \<^term>\<open>f(0::nat)\<close>.
The proof is by induction on \<^prop>\<open>f(0::nat) \<in> Avoid s A\<close>. However,
this requires the following
reformulation, as explained in \S\ref{sec:ind-var-in-prems} above;
the \<open>rule_format\<close> directive undoes the reformulation after the proof.
\<close>
lemma ex_infinite_path[rule_format]:
"t \<in> Avoid s A \<Longrightarrow>
\<forall>f\<in>Paths t. (\<forall>i. f i \<notin> A) \<longrightarrow> (\<exists>p\<in>Paths s. \<forall>i. p i \<notin> A)"
apply(erule Avoid.induct)
apply(blast)
apply(clarify)
apply(drule_tac x = "\<lambda>i. case i of 0 \<Rightarrow> t | Suc i \<Rightarrow> f i" in bspec)
apply(simp_all add: Paths_def split: nat.split)
done
text\<open>\noindent
The base case (\<^prop>\<open>t = s\<close>) is trivial and proved by \<open>blast\<close>.
In the induction step, we have an infinite \<^term>\<open>A\<close>-avoiding path \<^term>\<open>f\<close>
starting from \<^term>\<open>u\<close>, a successor of \<^term>\<open>t\<close>. Now we simply instantiate
the \<open>\<forall>f\<in>Paths t\<close> in the induction hypothesis by the path starting with
\<^term>\<open>t\<close> and continuing with \<^term>\<open>f\<close>. That is what the above $\lambda$-term
expresses. Simplification shows that this is a path starting with \<^term>\<open>t\<close>
and that the instantiated induction hypothesis implies the conclusion.
Now we come to the key lemma. Assuming that no infinite \<^term>\<open>A\<close>-avoiding
path starts from \<^term>\<open>s\<close>, we want to show \<^prop>\<open>s \<in> lfp(af A)\<close>. For the
inductive proof this must be generalized to the statement that every point \<^term>\<open>t\<close>
``between'' \<^term>\<open>s\<close> and \<^term>\<open>A\<close>, in other words all of \<^term>\<open>Avoid s A\<close>,
is contained in \<^term>\<open>lfp(af A)\<close>:
\<close>
lemma Avoid_in_lfp[rule_format(no_asm)]:
"\<forall>p\<in>Paths s. \<exists>i. p i \<in> A \<Longrightarrow> t \<in> Avoid s A \<longrightarrow> t \<in> lfp(af A)"
txt\<open>\noindent
The proof is by induction on the ``distance'' between \<^term>\<open>t\<close> and \<^term>\<open>A\<close>. Remember that \<^prop>\<open>lfp(af A) = A \<union> M\<inverse> `` lfp(af A)\<close>.
If \<^term>\<open>t\<close> is already in \<^term>\<open>A\<close>, then \<^prop>\<open>t \<in> lfp(af A)\<close> is
trivial. If \<^term>\<open>t\<close> is not in \<^term>\<open>A\<close> but all successors are in
\<^term>\<open>lfp(af A)\<close> (induction hypothesis), then \<^prop>\<open>t \<in> lfp(af A)\<close> is
again trivial.
The formal counterpart of this proof sketch is a well-founded induction
on~\<^term>\<open>M\<close> restricted to \<^term>\<open>Avoid s A - A\<close>, roughly speaking:
@{term[display]"{(y,x). (x,y) \<in> M \<and> x \<in> Avoid s A \<and> x \<notin> A}"}
As we shall see presently, the absence of infinite \<^term>\<open>A\<close>-avoiding paths
starting from \<^term>\<open>s\<close> implies well-foundedness of this relation. For the
moment we assume this and proceed with the induction:
\<close>
apply(subgoal_tac "wf{(y,x). (x,y) \<in> M \<and> x \<in> Avoid s A \<and> x \<notin> A}")
apply(erule_tac a = t in wf_induct)
apply(clarsimp)
(*<*)apply(rename_tac t)(*>*)
txt\<open>\noindent
@{subgoals[display,indent=0,margin=65]}
Now the induction hypothesis states that if \<^prop>\<open>t \<notin> A\<close>
then all successors of \<^term>\<open>t\<close> that are in \<^term>\<open>Avoid s A\<close> are in
\<^term>\<open>lfp (af A)\<close>. Unfolding \<^term>\<open>lfp\<close> in the conclusion of the first
subgoal once, we have to prove that \<^term>\<open>t\<close> is in \<^term>\<open>A\<close> or all successors
of \<^term>\<open>t\<close> are in \<^term>\<open>lfp (af A)\<close>. But if \<^term>\<open>t\<close> is not in \<^term>\<open>A\<close>,
the second
\<^const>\<open>Avoid\<close>-rule implies that all successors of \<^term>\<open>t\<close> are in
\<^term>\<open>Avoid s A\<close>, because we also assume \<^prop>\<open>t \<in> Avoid s A\<close>.
Hence, by the induction hypothesis, all successors of \<^term>\<open>t\<close> are indeed in
\<^term>\<open>lfp(af A)\<close>. Mechanically:
\<close>
apply(subst lfp_unfold[OF mono_af])
apply(simp (no_asm) add: af_def)
apply(blast intro: Avoid.intros)
txt\<open>
Having proved the main goal, we return to the proof obligation that the
relation used above is indeed well-founded. This is proved by contradiction: if
the relation is not well-founded then there exists an infinite \<^term>\<open>A\<close>-avoiding path all in \<^term>\<open>Avoid s A\<close>, by theorem
@{thm[source]wf_iff_no_infinite_down_chain}:
@{thm[display]wf_iff_no_infinite_down_chain[no_vars]}
From lemma @{thm[source]ex_infinite_path} the existence of an infinite
\<^term>\<open>A\<close>-avoiding path starting in \<^term>\<open>s\<close> follows, contradiction.
\<close>
apply(erule contrapos_pp)
apply(simp add: wf_iff_no_infinite_down_chain)
apply(erule exE)
apply(rule ex_infinite_path)
apply(auto simp add: Paths_def)
done
text\<open>
The \<open>(no_asm)\<close> modifier of the \<open>rule_format\<close> directive in the
statement of the lemma means
that the assumption is left unchanged; otherwise the \<open>\<forall>p\<close>
would be turned
into a \<open>\<And>p\<close>, which would complicate matters below. As it is,
@{thm[source]Avoid_in_lfp} is now
@{thm[display]Avoid_in_lfp[no_vars]}
The main theorem is simply the corollary where \<^prop>\<open>t = s\<close>,
when the assumption \<^prop>\<open>t \<in> Avoid s A\<close> is trivially true
by the first \<^const>\<open>Avoid\<close>-rule. Isabelle confirms this:%
\index{CTL|)}\<close>
theorem AF_lemma2: "{s. \<forall>p \<in> Paths s. \<exists> i. p i \<in> A} \<subseteq> lfp(af A)"
by(auto elim: Avoid_in_lfp intro: Avoid.intros)
(*<*)end(*>*)
|
Sometimes writing callback-style asynchronous code with Tornado is a pain. But the real hurt comes when you want to refactor your async code into reusable subroutines. Tornado's coroutines make refactoring easy. I'll explain the rules.
I'll use this blog to illustrate. I built it with Motor-Blog, a trivial blog platform on top of Motor, my asynchronous MongoDB driver for Tornado.
When you came here, Motor-Blog did three or four MongoDB queries to render this page.
1: Find the blog post at this URL and show you this content.
2 and 3: Find the next and previous posts to render the navigation links at the bottom.
Maybe 4: If the list of categories on the left has changed since it was last cached, fetch the list.
Let's go through each query and see how Tornado coroutines make life easier.
Not so bad. But is it better with a coroutine?
Much better. If you don't pass a callback to find_one, then it returns a Future instance. A Future is nothing special, it's just a little object that represents an unresolved value. Some time hence, Motor will resolve the Future with a value or an exception. To wait for the Future to be resolved, yield it.
The yield statement makes this function a generator. gen.coroutine is a brilliant invention that runs the generator until it's complete. Each time the generator yields a Future, gen.coroutine schedules the generator to be resumed when the Future is resolved. Read the source code of the Runner class for details, it's exhilarating. Or just enjoy the glow of putting all your logic in a single function again, without defining any callbacks.
Even better, you get normal exception handling: if find_one gets a network error or some other failure, it raises an exception. Tornado knows how to turn an exception into an HTTP 500, so we no longer need special code for errors.
This coroutine is much more readable than a callback, but it doesn't look any nicer than multithreaded code. It will start to shine when you need to parallelize some tasks.
Once Motor-Blog finds the current post, it gets the next and previous posts so it can display their titles. Since the two queries are independent we can save a few milliseconds by doing them in parallel. How does this look with callbacks?
# Two queries in parallel.
# Find the previously published post.
# Find subsequently published post.
This is completely disgusting and it makes me want to give up on async. We need special logic in each callback to determine if the other callback has already run or not. All that boilerplate can't be factored out. Will a coroutine help?
Yielding a list of Futures tells the coroutine to wait until they are all resolved.
Now our single get function is just as nice as it would be with blocking code. In fact, the parallel fetch is far easier than if you were multithreading instead of using Tornado. But what about factoring out a common subroutine that request handlers can share?
This coroutine does not have to be part of a request handler—it stands on its own at the module scope.
The raise gen.Return() statement is the weirdest syntax in this example. It's an artifact of Python 2, in which generators aren't allowed to return values. To hack around this limitation, Tornado coroutines raise a special kind of exception called a Return. The coroutine catches this exception and treats it like a returned value. In Python 3, a simple return categories accomplishes the same result.
Since get_categories is a coroutine now, calling it returns a Future. To wait for get_categories to complete, the caller can yield the Future. Once get_categories completes, the Future it returned is resolved, so the caller resumes. It's almost like a regular function call!
Decorate the subroutine with @gen.coroutine.
In Python 2, the subroutine returns its result with raise gen.Return(result).
Call the subroutine from another coroutine like result = yield subroutine().
That's all there is to it. Tornado's coroutines make asynchronous code efficient, clean—even beautiful. |
[STATEMENT]
lemma preordered_finite_set_has_maxima:
assumes "finite A" "A \<noteq> {}"
shows "\<exists>a::'a::{preorder} \<in> A. \<forall>b \<in> A. \<not>(a < b)"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<exists>a\<in>A. \<forall>b\<in>A. \<not> a < b
[PROOF STEP]
using assms
[PROOF STATE]
proof (prove)
using this:
finite A
A \<noteq> {}
goal (1 subgoal):
1. \<exists>a\<in>A. \<forall>b\<in>A. \<not> a < b
[PROOF STEP]
proof (induction A rule: finite_induct)
[PROOF STATE]
proof (state)
goal (2 subgoals):
1. {} \<noteq> {} \<Longrightarrow> \<exists>a\<in>{}. \<forall>b\<in>{}. \<not> a < b
2. \<And>x F. \<lbrakk>finite F; x \<notin> F; F \<noteq> {} \<Longrightarrow> \<exists>a\<in>F. \<forall>b\<in>F. \<not> a < b; insert x F \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>a\<in>insert x F. \<forall>b\<in>insert x F. \<not> a < b
[PROOF STEP]
case (insert a A)
[PROOF STATE]
proof (state)
this:
finite A
a \<notin> A
A \<noteq> {} \<Longrightarrow> \<exists>a\<in>A. \<forall>b\<in>A. \<not> a < b
insert a A \<noteq> {}
goal (2 subgoals):
1. {} \<noteq> {} \<Longrightarrow> \<exists>a\<in>{}. \<forall>b\<in>{}. \<not> a < b
2. \<And>x F. \<lbrakk>finite F; x \<notin> F; F \<noteq> {} \<Longrightarrow> \<exists>a\<in>F. \<forall>b\<in>F. \<not> a < b; insert x F \<noteq> {}\<rbrakk> \<Longrightarrow> \<exists>a\<in>insert x F. \<forall>b\<in>insert x F. \<not> a < b
[PROOF STEP]
thus ?case
[PROOF STATE]
proof (prove)
using this:
finite A
a \<notin> A
A \<noteq> {} \<Longrightarrow> \<exists>a\<in>A. \<forall>b\<in>A. \<not> a < b
insert a A \<noteq> {}
goal (1 subgoal):
1. \<exists>aa\<in>insert a A. \<forall>b\<in>insert a A. \<not> aa < b
[PROOF STEP]
by (cases "A = {}", simp, metis insert_iff order_trans less_le_not_le)
[PROOF STATE]
proof (state)
this:
\<exists>aa\<in>insert a A. \<forall>b\<in>insert a A. \<not> aa < b
goal (1 subgoal):
1. {} \<noteq> {} \<Longrightarrow> \<exists>a\<in>{}. \<forall>b\<in>{}. \<not> a < b
[PROOF STEP]
qed simp |
\documentclass{article}[a4paper]
\usepackage[a4paper, left=2.5cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\usepackage{booktabs}
\usepackage{amsmath}
\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\usepackage{caption}
\captionsetup{width=.75\textwidth}
\usepackage[usestackEOL]{stackengine}
\usepackage{float}
\usepackage{subcaption}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,arrows,positioning,fit}
\usetikzlibrary{shapes,calc,arrows}
\usepackage{natbib}
\usepackage{graphicx}
\usepackage{subfiles}
\usepackage{blindtext}
\usepackage{hyperref}
\usepackage{float}
\usepackage[T1]{fontenc}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{fancyvrb}
\usepackage{xparse}
\usepackage{pmboxdraw}
\usepackage[utf8]{inputenc}
\NewDocumentCommand{\codeword}{v}{%
\texttt{\textcolor{blue}{#1}}%
}
\lstdefinestyle{tree}{
literate=
{├}{{\smash{\raisebox{-1ex}{\rule{1pt}{\baselineskip}}}\raisebox{0.5ex}{\rule{1ex}{1pt}}}}1
{─}{{\raisebox{0.5ex}{\rule{1.5ex}{1pt}}}}1
{└}{{\smash{\raisebox{0.5ex}{\rule{1pt}{\dimexpr\baselineskip-1.5ex}}}\raisebox{0.5ex}{\rule{1ex}{1pt}}}}1
}
\def\XXX#1{\textcolor{red}{XXX #1}}
\newcommand{\vect}[1]{\boldsymbol{#1}}
\title{\textbf{Computational Linguistics} \\
Assignment 4\\
Word alignments
}
\author{Sangeet Sagar\\
\texttt{[email protected]}
}
\date{\today}
% \pgfplotsset{compat=1.17}
\begin{document}
\maketitle
%#################################################################
\section{Introduction}
This assignment implements the IBM Model 1, which is used in statistical machine translation (SMT) to train word alignment model. So IBM models in general are generative models, which break up the translation process into smaller steps and achieve better statistics with simpler models.
\textbf{IBM Model 1} uses only lexical translation. It ignores any position information (order), resulting in translating multisets of words into multisets of words.
\section{Description}
The script:
\begin{itemize}
\item \texttt{main.py}: this is the main script that you should be running.
\item \texttt{ibm\_model1.py}: IBM Model 1 class file.
\end{itemize}
The alignment extraction has been performed in two ways. Let's discuss them:
\begin{itemize}
\item \textbf{One-to-one alignment}: For every source (English) token, we only take one target token corresponding to the maximum translation probability score.
\item \textbf{One-to-many alignment}: We set a threshold score i.e. \codeword{alpha} and for every source token, we only take target tokens whose translation probability score is equal or greater than the threshold. This results in a superior performance which have been discussed in a further section.
\end{itemize}
I also had a chance to compare results from IMB model 1 with an off-the-shelf aligner \textbf{MGIZA}. Already, having the compiled version for this library, I used it to generate alignments as given in \texttt{results\/mgiza\_out.txt} (trained on entire dataset but has alignments only for first 1000 sentences). These were further processed into an index2index format using the script \texttt{read\_mgiza\_alignmetns.py}, that is accepted by the evaluation script.
\section{Requirements}
The scripts have been tested on:
\begin{enumerate}
\item Python: \codeword{3.8.3}
\item Numpy: \codeword{1.19.2}
\item tqdm: \codeword{1.6.3}. Install: \codeword{pip install tqdm}
\end{enumerate}
\section{Project file structure}
\begin{Verbatim}
├── ibm_model1.py
├── main.py
├── README.md
├── read_mgiza_alignmetns.py
└── results
├── grid_alignment_one2many.txt
├── grid_alignment_one2one.txt
├── ibm1_one2many_alpha0.3.a
├── ibm1_one2one.a
├── mgiza.a
└── mgiza_out.txt
\end{Verbatim}
\section{Usage}
\begin{itemize}
\item \textbf{Help}: for instructions on how to run the script with appropriate arguments.\\
\codeword{python main.py --help}\\
\begin{lstlisting}[basicstyle=\small]
python main.py --help
usage: main.py [-h]
[-epochs EPOCHS]
[-num_sents NUM_SENTS]
[-alpha ALPHA]
[-save_model SAVE_MODEL]
eng_f
foreign_f
out_dir
Implementation of IBM Model 1, which is used in statistical
machine translation to train an alignment model.
positional arguments:
eng_f path to source (eng) file
foreign_f path to target (foreign) file
out_dir output-dir to save the obtained alignments
optional arguments:
-h, --help show this help message and exit
-epochs EPOCHS number of training epochs for EM
-num_sents NUM_SENTS number of sentences to train from
-alpha ALPHA threshold score of translation probability
for alignment
-save_model SAVE_MODEL save trained model
\end{lstlisting}
\item \textbf{Run IBM Model 1}: Given 100K English $\leftrightarrow$ French parallel sentences, run IBM model 1 and generate one-to-one word alignments\\
\codeword{python main.py jhu-mt-hw/hw2/data/hansards.e jhu-mt-hw/hw2/data/hansards.f results/}
\begin{itemize}
\begin{Verbatim}
\end{Verbatim}
\end{itemize}
\item Run IBM model 1 and generate \textbf{one-to-many} word alignments. \\
\codeword{python main.py jhu-mt-hw/hw2/data/hansards.e jhu-mt-hw/hw2/data/hansards.f results/ -alpha 0.30}
\end{itemize}
\section{Evaluation}
\begin{itemize}
\item One-to-one alignment\\
\codeword{python jhu-mt-hw/hw2/score-alignments < results/ibm1_one2one.a}
\item one-to-many alignment (with \codeword{alpha 0.3})\\
\codeword{python jhu-mt-hw/hw2/score-alignments < results/ibm1_one2many_alpha_0.3.a}
\item MGIZA alignment\\
\codeword{python jhu-mt-hw/hw2/score-alignments < results/mgiza.a}
\end{itemize}
\section{Datatset}
Trained on 100K parallel English $\leftrightarrow$ French sentences from \href{https://catalog.ldc.upenn.edu/LDC95T20}{Hansard French/English dataset}.
\section{Runtime}
\begin{itemize}
\item \textbf{Total} runtime: 1148.180 s
\item \textbf{Aligner (IBM model 1)} runtime: 1142.530 s
\item \textbf{Alignment extraction} runtime: 0.704 s
\end{itemize}
\section{Results}
\begin{itemize}
\item \textbf{Baseline}
\begin{Verbatim}
Precision = 0.243110
Recall = 0.544379
AER = 0.681684
\end{Verbatim}
\item \textbf{IBM Model 1}
\begin{itemize}
\item \textbf{one-to-one alignment}
\begin{Verbatim}
Precision = 0.904762
Recall = 0.491124
AER = 0.350365
\end{Verbatim}
\item \textbf{one-to-many alignment}: \codeword{alpha 0.30}
\begin{Verbatim}
Precision = 0.854103
Recall = 0.677515
AER = 0.235382382
\end{Verbatim}
\end{itemize}
\item Off-the-shelf aligner: \textbf{MGIZA}, already having the compiled version of MGIZA, I used it to generate alignments and results were:
\begin{Verbatim}
Precision = 0.752577
Recall = 0.872781
AER = 0.207473
\end{Verbatim}
\end{itemize}
\section{Glimpse of results}
While all alignments (\codeword{*.a} files) and alignment-grids (\codeword{*.txt} files) can be found in \texttt{results}, here is a glimpse of an alignment grid:
\\~\\
\\~\\
\\~\\
\\~\\
\\~\\
\begin{itemize}
\item One-to-one alignment
\begin{Verbatim}
Alignment 5 KEY: ( ) = guessed, * = sure, ? = possible
------------------------------------
| * | je
| * | ne
| ? | ai
| (*) | jamais
| (?) | rencontré
| * | une
| | seule
| (*) | prostituée
| ? | de
| * | rue
| * | qui
| * | voulait
| ? ? ? | exercer
| ( ) ? ? ? | un
| ? ? ? | tel
| ? ? ? | métier
| (*) | .
------------------------------------
I n m a s h w w t b t .
e e t o h a o e h
v t r o o n e
e e k t r
r e e e e
t r d
\end{Verbatim}
\item One-to-many alignment (with \codeword{alpha 0.3})
\begin{Verbatim}
Alignment 5 KEY: ( ) = guessed, * = sure, ? = possible
------------------------------------
|(*) | je
| * | ne
|( ) ? | ai
| (*) | jamais
| (?) | rencontré
| (*) | une
| | seule
| * ( ) | prostituée
| ? | de
| * | rue
| (*) | qui
| (*) | voulait
| ? ? ? | exercer
| ( ) ? ? ? | un
| ? ? ? | tel
| ? ? ? | métier
| (*) | .
------------------------------------
I n m a s h w w t b t .
e e t o h a o e h
v t r o o n e
e e k t r
r e e e e
t r d
\end{Verbatim}
\item MGIZA alignment
\begin{Verbatim}
Alignment 5 KEY: ( ) = guessed, * = sure, ? = possible
------------------------------------
|(*) | je
| (*) | ne
| (?) | ai
| (*) | jamais
| (?) | rencontré
| (*) | une
| ( ) | seule
| (*) | prostituée
| ? | de
| * ( ) | rue
| (*) | qui
| (*) | voulait
| ( ) ? ? ? | exercer
| ? (?) ? | un
| ( ) ? ? ? | tel
| ( ) ? ? ? | métier
| (*) | .
------------------------------------
I n m a s h w w t b t .
e e t o h a o e h
v t r o o n e
e e k t r
r e e e e
t r d
\end{Verbatim}
\end{itemize}
\bibliographystyle{plain}
\bibliography{references}
\end{document}
|
print("Hello world")
print("Hi"
# this is bad
|
function [A,uE2F,uE] = facet_adjacency_matrix(F,varargin)
% FACET_ADJACENCY_MATRIX Adjacency matrix between facets determined by
% whether two facets share an edge.
%
% A = facet_adjacency_matrix(F)
% A = facet_adjacency_matrix(F,'ParameterName',ParameterValue, ...)
%
% Inputs:
% F #F by 3 list of triangles
% Optional:
% 'ManifoldOnly' followed by whether to only consider adjacency across
% manifold edges (valence <=2) {false}
% Outputs:
% A #F by #F adjacency matrix
% uE2F #E by #F matrix so that (e,f) = 1 means face f is adjacent to
% unique edge e
% uE #E by 2 list of unique edges
%
% See also: adjacency_matrix
manifold_only = false;
% default values
% Map of parameter names to variable names
params_to_variables = containers.Map( ...
{'ManifoldOnly'},{'manifold_only'});
v = 1;
while v <= numel(varargin)
param_name = varargin{v};
if isKey(params_to_variables,param_name)
assert(v+1<=numel(varargin));
v = v+1;
% Trick: use feval on anonymous function to use assignin to this workspace
feval(@()assignin('caller',params_to_variables(param_name),varargin{v}));
else
error('Unsupported parameter: %s',varargin{v});
end
v=v+1;
end
ss = size(F,2);
switch ss
case 3
% List of all "half"-edges: 3*#F by 2
allE = [F(:,[2 3]); F(:,[3 1]); F(:,[1 2])];
% Sort each row
sortallE = sort(allE,2);
% IC(i) tells us where to find sortallE(i,:) in uE:
% so that sortallE(i,:) = uE(IC(i),:)
[uE,~,IC] = unique(sortallE,'rows');
% uE2F(e,f) = 1 means face f is adjacent to unique edge e
uE2F = sparse(IC(:),repmat(1:size(F,1),1,ss)',1);
case 2
% We're really dealing with edges, so E-->vertices, F-->edges
uE = 1:max(F(:));
uE2F = sparse(F,repmat(1:size(F,1),2,1)',1);
end
% kill non-manifold edges
if manifold_only
uE2F(sum(uE2F,2)>2,:) = 0;
end
% Face-face Adjacency matrix
A = uE2F'*uE2F;
% All ones
A = A>0;
end
|
/-
Copyright (c) 2018 Chris Hughes. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Chris Hughes, Johannes Hölzl, Scott Morrison, Jens Wagemaker
-/
import Mathlib.PrePort
import Mathlib.Lean3Lib.init.default
import Mathlib.data.polynomial.ring_division
import Mathlib.data.polynomial.derivative
import Mathlib.algebra.gcd_monoid
import Mathlib.PostPort
universes u y v u_1
namespace Mathlib
/-!
# Theory of univariate polynomials
This file starts looking like the ring theory of $ R[X] $
-/
namespace polynomial
protected instance normalization_monoid {R : Type u} [integral_domain R] [normalization_monoid R] : normalization_monoid (polynomial R) :=
normalization_monoid.mk
(fun (p : polynomial R) =>
units.mk (coe_fn C ↑(norm_unit (leading_coeff p))) (coe_fn C ↑(norm_unit (leading_coeff p)⁻¹)) sorry sorry)
sorry sorry sorry
@[simp] theorem coe_norm_unit {R : Type u} [integral_domain R] [normalization_monoid R] {p : polynomial R} : ↑(norm_unit p) = coe_fn C ↑(norm_unit (leading_coeff p)) := sorry
theorem leading_coeff_normalize {R : Type u} [integral_domain R] [normalization_monoid R] (p : polynomial R) : leading_coeff (coe_fn normalize p) = coe_fn normalize (leading_coeff p) := sorry
theorem is_unit_iff_degree_eq_zero {R : Type u} [field R] {p : polynomial R} : is_unit p ↔ degree p = 0 := sorry
theorem degree_pos_of_ne_zero_of_nonunit {R : Type u} [field R] {p : polynomial R} (hp0 : p ≠ 0) (hp : ¬is_unit p) : 0 < degree p := sorry
theorem monic_mul_leading_coeff_inv {R : Type u} [field R] {p : polynomial R} (h : p ≠ 0) : monic (p * coe_fn C (leading_coeff p⁻¹)) := sorry
theorem degree_mul_leading_coeff_inv {R : Type u} [field R] {q : polynomial R} (p : polynomial R) (h : q ≠ 0) : degree (p * coe_fn C (leading_coeff q⁻¹)) = degree p := sorry
theorem irreducible_of_monic {R : Type u} [field R] {p : polynomial R} (hp1 : monic p) (hp2 : p ≠ 1) : irreducible p ↔ ∀ (f g : polynomial R), monic f → monic g → f * g = p → f = 1 ∨ g = 1 := sorry
/-- Division of polynomials. See polynomial.div_by_monic for more details.-/
def div {R : Type u} [field R] (p : polynomial R) (q : polynomial R) : polynomial R :=
coe_fn C (leading_coeff q⁻¹) * (p /ₘ (q * coe_fn C (leading_coeff q⁻¹)))
/-- Remainder of polynomial division, see the lemma `quotient_mul_add_remainder_eq_aux`.
See polynomial.mod_by_monic for more details. -/
def mod {R : Type u} [field R] (p : polynomial R) (q : polynomial R) : polynomial R :=
p %ₘ (q * coe_fn C (leading_coeff q⁻¹))
protected instance has_div {R : Type u} [field R] : Div (polynomial R) :=
{ div := div }
protected instance has_mod {R : Type u} [field R] : Mod (polynomial R) :=
{ mod := mod }
theorem div_def {R : Type u} [field R] {p : polynomial R} {q : polynomial R} : p / q = coe_fn C (leading_coeff q⁻¹) * (p /ₘ (q * coe_fn C (leading_coeff q⁻¹))) :=
rfl
theorem mod_def {R : Type u} [field R] {p : polynomial R} {q : polynomial R} : p % q = p %ₘ (q * coe_fn C (leading_coeff q⁻¹)) :=
rfl
theorem mod_by_monic_eq_mod {R : Type u} [field R] {q : polynomial R} (p : polynomial R) (hq : monic q) : p %ₘ q = p % q := sorry
theorem div_by_monic_eq_div {R : Type u} [field R] {q : polynomial R} (p : polynomial R) (hq : monic q) : p /ₘ q = p / q := sorry
theorem mod_X_sub_C_eq_C_eval {R : Type u} [field R] (p : polynomial R) (a : R) : p % (X - coe_fn C a) = coe_fn C (eval a p) :=
mod_by_monic_eq_mod p (monic_X_sub_C a) ▸ mod_by_monic_X_sub_C_eq_C_eval p a
theorem mul_div_eq_iff_is_root {R : Type u} {a : R} [field R] {p : polynomial R} : (X - coe_fn C a) * (p / (X - coe_fn C a)) = p ↔ is_root p a :=
div_by_monic_eq_div p (monic_X_sub_C a) ▸ mul_div_by_monic_eq_iff_is_root
protected instance euclidean_domain {R : Type u} [field R] : euclidean_domain (polynomial R) :=
euclidean_domain.mk comm_ring.add sorry comm_ring.zero sorry sorry comm_ring.neg comm_ring.sub sorry sorry comm_ring.mul
sorry comm_ring.one sorry sorry sorry sorry sorry sorry Div.div sorry Mod.mod quotient_mul_add_remainder_eq_aux
(fun (p q : polynomial R) => degree p < degree q) sorry sorry sorry
theorem mod_eq_self_iff {R : Type u} [field R] {p : polynomial R} {q : polynomial R} (hq0 : q ≠ 0) : p % q = p ↔ degree p < degree q := sorry
theorem div_eq_zero_iff {R : Type u} [field R] {p : polynomial R} {q : polynomial R} (hq0 : q ≠ 0) : p / q = 0 ↔ degree p < degree q := sorry
theorem degree_add_div {R : Type u} [field R] {p : polynomial R} {q : polynomial R} (hq0 : q ≠ 0) (hpq : degree q ≤ degree p) : degree q + degree (p / q) = degree p := sorry
theorem degree_div_le {R : Type u} [field R] (p : polynomial R) (q : polynomial R) : degree (p / q) ≤ degree p := sorry
theorem degree_div_lt {R : Type u} [field R] {p : polynomial R} {q : polynomial R} (hp : p ≠ 0) (hq : 0 < degree q) : degree (p / q) < degree p := sorry
@[simp] theorem degree_map {R : Type u} {k : Type y} [field R] [field k] (p : polynomial R) (f : R →+* k) : degree (map f p) = degree p :=
degree_map_eq_of_injective (ring_hom.injective f) p
@[simp] theorem nat_degree_map {R : Type u} {k : Type y} [field R] {p : polynomial R} [field k] (f : R →+* k) : nat_degree (map f p) = nat_degree p :=
nat_degree_eq_of_degree_eq (degree_map p f)
@[simp] theorem leading_coeff_map {R : Type u} {k : Type y} [field R] {p : polynomial R} [field k] (f : R →+* k) : leading_coeff (map f p) = coe_fn f (leading_coeff p) := sorry
theorem monic_map_iff {R : Type u} {k : Type y} [field R] [field k] {f : R →+* k} {p : polynomial R} : monic (map f p) ↔ monic p := sorry
theorem is_unit_map {R : Type u} {k : Type y} [field R] {p : polynomial R} [field k] (f : R →+* k) : is_unit (map f p) ↔ is_unit p := sorry
theorem map_div {R : Type u} {k : Type y} [field R] {p : polynomial R} {q : polynomial R} [field k] (f : R →+* k) : map f (p / q) = map f p / map f q := sorry
theorem map_mod {R : Type u} {k : Type y} [field R] {p : polynomial R} {q : polynomial R} [field k] (f : R →+* k) : map f (p % q) = map f p % map f q := sorry
theorem gcd_map {R : Type u} {k : Type y} [field R] {p : polynomial R} {q : polynomial R} [field k] (f : R →+* k) : euclidean_domain.gcd (map f p) (map f q) = map f (euclidean_domain.gcd p q) := sorry
theorem eval₂_gcd_eq_zero {R : Type u} {k : Type y} [field R] [comm_semiring k] {ϕ : R →+* k} {f : polynomial R} {g : polynomial R} {α : k} (hf : eval₂ ϕ α f = 0) (hg : eval₂ ϕ α g = 0) : eval₂ ϕ α (euclidean_domain.gcd f g) = 0 := sorry
theorem eval_gcd_eq_zero {R : Type u} [field R] {f : polynomial R} {g : polynomial R} {α : R} (hf : eval α f = 0) (hg : eval α g = 0) : eval α (euclidean_domain.gcd f g) = 0 :=
eval₂_gcd_eq_zero hf hg
theorem root_left_of_root_gcd {R : Type u} {k : Type y} [field R] [comm_semiring k] {ϕ : R →+* k} {f : polynomial R} {g : polynomial R} {α : k} (hα : eval₂ ϕ α (euclidean_domain.gcd f g) = 0) : eval₂ ϕ α f = 0 := sorry
theorem root_right_of_root_gcd {R : Type u} {k : Type y} [field R] [comm_semiring k] {ϕ : R →+* k} {f : polynomial R} {g : polynomial R} {α : k} (hα : eval₂ ϕ α (euclidean_domain.gcd f g) = 0) : eval₂ ϕ α g = 0 := sorry
theorem root_gcd_iff_root_left_right {R : Type u} {k : Type y} [field R] [comm_semiring k] {ϕ : R →+* k} {f : polynomial R} {g : polynomial R} {α : k} : eval₂ ϕ α (euclidean_domain.gcd f g) = 0 ↔ eval₂ ϕ α f = 0 ∧ eval₂ ϕ α g = 0 := sorry
theorem is_root_gcd_iff_is_root_left_right {R : Type u} [field R] {f : polynomial R} {g : polynomial R} {α : R} : is_root (euclidean_domain.gcd f g) α ↔ is_root f α ∧ is_root g α :=
root_gcd_iff_root_left_right
theorem is_coprime_map {R : Type u} {k : Type y} [field R] {p : polynomial R} {q : polynomial R} [field k] (f : R →+* k) : is_coprime (map f p) (map f q) ↔ is_coprime p q := sorry
@[simp] theorem map_eq_zero {R : Type u} {S : Type v} [field R] {p : polynomial R} [semiring S] [nontrivial S] (f : R →+* S) : map f p = 0 ↔ p = 0 := sorry
theorem map_ne_zero {R : Type u} {S : Type v} [field R] {p : polynomial R} [semiring S] [nontrivial S] {f : R →+* S} (hp : p ≠ 0) : map f p ≠ 0 :=
mt (iff.mp (map_eq_zero f)) hp
theorem mem_roots_map {R : Type u} {k : Type y} [field R] {p : polynomial R} [field k] {f : R →+* k} {x : k} (hp : p ≠ 0) : x ∈ roots (map f p) ↔ eval₂ f x p = 0 := sorry
theorem exists_root_of_degree_eq_one {R : Type u} [field R] {p : polynomial R} (h : degree p = 1) : ∃ (x : R), is_root p x := sorry
theorem coeff_inv_units {R : Type u} [field R] (u : units (polynomial R)) (n : ℕ) : coeff (↑u) n⁻¹ = coeff (↑(u⁻¹)) n := sorry
theorem monic_normalize {R : Type u} [field R] {p : polynomial R} (hp0 : p ≠ 0) : monic (coe_fn normalize p) := sorry
theorem coe_norm_unit_of_ne_zero {R : Type u} [field R] {p : polynomial R} (hp : p ≠ 0) : ↑(norm_unit p) = coe_fn C (leading_coeff p⁻¹) := sorry
theorem normalize_monic {R : Type u} [field R] {p : polynomial R} (h : monic p) : coe_fn normalize p = p := sorry
theorem map_dvd_map' {R : Type u} {k : Type y} [field R] [field k] (f : R →+* k) {x : polynomial R} {y : polynomial R} : map f x ∣ map f y ↔ x ∣ y := sorry
theorem degree_normalize {R : Type u} [field R] {p : polynomial R} : degree (coe_fn normalize p) = degree p := sorry
theorem prime_of_degree_eq_one {R : Type u} [field R] {p : polynomial R} (hp1 : degree p = 1) : prime p := sorry
theorem irreducible_of_degree_eq_one {R : Type u} [field R] {p : polynomial R} (hp1 : degree p = 1) : irreducible p :=
irreducible_of_prime (prime_of_degree_eq_one hp1)
theorem not_irreducible_C {R : Type u} [field R] (x : R) : ¬irreducible (coe_fn C x) := sorry
theorem degree_pos_of_irreducible {R : Type u} [field R] {p : polynomial R} (hp : irreducible p) : 0 < degree p :=
lt_of_not_ge
fun (hp0 : 0 ≥ degree p) =>
(fun (this : p = coe_fn C (coeff p 0)) => not_irreducible_C (coeff p 0) (this ▸ hp)) (eq_C_of_degree_le_zero hp0)
theorem pairwise_coprime_X_sub {α : Type u} [field α] {I : Type v} {s : I → α} (H : function.injective s) : pairwise (is_coprime on fun (i : I) => X - coe_fn C (s i)) := sorry
/-- If `f` is a polynomial over a field, and `a : K` satisfies `f' a ≠ 0`,
then `f / (X - a)` is coprime with `X - a`.
Note that we do not assume `f a = 0`, because `f / (X - a) = (f - f a) / (X - a)`. -/
theorem is_coprime_of_is_root_of_eval_derivative_ne_zero {K : Type u_1} [field K] (f : polynomial K) (a : K) (hf' : eval a (coe_fn derivative f) ≠ 0) : is_coprime (X - coe_fn C a) (f /ₘ (X - coe_fn C a)) := sorry
theorem prod_multiset_root_eq_finset_root {R : Type u} [field R] {p : polynomial R} (hzero : p ≠ 0) : multiset.prod (multiset.map (fun (a : R) => X - coe_fn C a) (roots p)) =
finset.prod (multiset.to_finset (roots p)) fun (a : R) => (fun (a : R) => (X - coe_fn C a) ^ root_multiplicity a p) a := sorry
/-- The product `∏ (X - a)` for `a` inside the multiset `p.roots` divides `p`. -/
theorem prod_multiset_X_sub_C_dvd {R : Type u} [field R] (p : polynomial R) : multiset.prod (multiset.map (fun (a : R) => X - coe_fn C a) (roots p)) ∣ p := sorry
theorem roots_C_mul {R : Type u} [field R] (p : polynomial R) {a : R} (hzero : a ≠ 0) : roots (coe_fn C a * p) = roots p := sorry
theorem roots_normalize {R : Type u} [field R] {p : polynomial R} : roots (coe_fn normalize p) = roots p := sorry
|
import Data.Bits
import Data.DPair
import Data.Nat
import Data.So
namespace SubsetNat
public export
fromInteger : (x : Integer) ->
{0 n : Nat} ->
{auto 0 prf : fromInteger x `LT` n} ->
Subset Nat (`LT` n)
fromInteger x = Element (integerToNat x) prf
f : Int -> Int
f x = shiftR x 1
|
(*
Copyright 2014 Cornell University
This file is part of VPrl (the Verified Nuprl project).
VPrl is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
VPrl 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with VPrl. If not, see <http://www.gnu.org/licenses/>.
Website: http://nuprl.org/html/verification/
Authors: Abhishek Anand & Vincent Rahli
*)
Require Export per_props.
Lemma mkc_pertype_equality_in_uni {p} :
forall lib (R1 R2 : @CTerm p) i,
equality lib (mkc_pertype R1) (mkc_pertype R2) (mkc_uni i)
<=> (forall x y, member lib (mkc_apply2 R1 x y) (mkc_uni i))
# (forall x y, member lib (mkc_apply2 R2 x y) (mkc_uni i))
# (forall x y,
inhabited_type lib (mkc_apply2 R1 x y)
<=>
inhabited_type lib (mkc_apply2 R2 x y))
# is_per_type lib R1.
Proof.
introv; split; intro equ; repnd.
- unfold equality, nuprl in equ; exrepnd.
inversion equ1; subst; try not_univ.
duniv j h.
allrw @univi_exists_iff; exrepnd.
computes_to_value_isvalue; GC.
rw h0 in equ0; exrepnd.
inversion equ2; subst; try not_univ.
dest_per.
allfold (@nuprl p); allfold (@nuprli p lib j0).
computes_to_value_isvalue.
dands; introv.
generalize (typ1 x y); intro k.
unfold member, equality.
exists eq; sp.
allrw.
exists (eq1 x y); sp.
generalize (typ2 x y); intro k.
unfold member, equality.
exists eq; sp.
allrw.
exists (eq2 x y); sp.
generalize (typ1 x y); intro k1.
generalize (typ2 x y); intro k2.
allapply @nuprli_implies_nuprl.
generalize (inhabited_type_iff lib (mkc_apply2 R0 x y) (mkc_apply2 R3 x y) (eq1 x y) (eq2 x y)); intro iff; repeat (dest_imp iff hyp).
rw <- iff; sp.
generalize (is_per_type_iff_is_per lib R0 eq1); introv iff.
dest_imp iff hyp.
intros.
generalize (typ1 x y); intro k1.
allapply @nuprli_implies_nuprl; sp.
rw <- iff; sp.
- repnd.
unfold equality, nuprl.
exists (fun A A' => {eqa : per(p) , close lib (univi lib i) A A' eqa}); sp.
apply CL_init.
exists (S i); simpl; left; sp; spcast; try computes_to_value_refl.
fold (@nuprli p lib i).
assert (forall x y : CTerm,
{eq : per
, nuprli lib i (mkc_apply2 R1 x y) (mkc_apply2 R1 x y) eq}) as f1.
(* begin proof of the assert *)
intros.
unfold member, equality in equ0.
generalize (equ0 x y); intro k; exrepnd.
inversion k1; try not_univ.
duniv j h.
allrw @univi_exists_iff; exrepnd.
computes_to_value_isvalue; GC.
rw h0 in k0; exrepnd.
allfold (@nuprli p lib j0).
exists eqa; sp.
(* end of proof of the assert *)
assert (forall x y : CTerm,
{eq : per
, nuprli lib i (mkc_apply2 R2 x y) (mkc_apply2 R2 x y) eq}) as f2.
(* begin proof of the assert *)
intros.
unfold member, equality in equ1.
generalize (equ1 x y); intro k; exrepnd.
inversion k1; try not_univ.
duniv j h.
allrw @univi_exists_iff; exrepnd.
computes_to_value_isvalue; GC.
rw h0 in k0; exrepnd.
allfold (@nuprli p lib j0).
exists eqa; sp.
(* end of proof of the assert *)
generalize (choice_spteqi lib i (mkc_apply2 R1) (mkc_apply2 R1)); intro fn1.
generalize (choice_spteqi lib i (mkc_apply2 R2) (mkc_apply2 R2)); intro fn2.
dest_imp fn1 hyp.
dest_imp fn2 hyp.
exrepnd.
exists (fun t t' => inhabited (f0 t t')).
apply CL_pertype.
fold (@nuprli p lib i).
unfold per_pertype.
exists R1 R2
(fun t t' => f0 t t')
(fun t t' => f t t');
sp; try (spcast; computes_to_value_refl); try (fold nuprl).
generalize (fn0 x y); intro n1.
generalize (fn2 x y); intro n2.
allapply @nuprli_implies_nuprl.
generalize (inhabited_type_iff lib (mkc_apply2 R1 x y) (mkc_apply2 R2 x y) (f0 x y) (f x y)); intro iff; repeat (dest_imp iff hyp).
rw iff; sp.
generalize (is_per_type_iff_is_per lib R1 f0); introv iff.
dest_imp iff hyp.
intros.
generalize (fn2 x y); intro k1.
allapply @nuprli_implies_nuprl; sp.
rw iff; sp.
Qed.
(*
(*Error: Universe inconsistency.*)
Admitted.
*)
Lemma mkc_ipertype_equality_in_uni {p} :
forall lib (R1 R2 : @CTerm p) i,
equality lib (mkc_ipertype R1) (mkc_ipertype R2) (mkc_uni i)
<=> (forall x y, equality lib (mkc_apply2 R1 x y) (mkc_apply2 R2 x y) (mkc_uni i))
# is_per_type lib R1.
Proof.
introv; split; intro equ; repnd.
- unfold equality, nuprl in equ; exrepnd.
inversion equ1; subst; try not_univ.
duniv j h.
allrw @univi_exists_iff; exrepnd.
computes_to_value_isvalue; GC.
rw h0 in equ0; exrepnd.
inversion equ2; subst; try not_univ.
dest_per.
allfold (@nuprl p lib); allfold (@nuprli p lib j0).
computes_to_value_isvalue.
dands; introv.
generalize (eqtyps x y); intro k.
exists eq; sp; allrw.
exists (eq1 x y); sp.
generalize (is_per_type_iff_is_per lib R0 eq1); introv iff.
dest_imp iff hyp.
intros.
generalize (eqtyps x y); intro k1.
allapply @nuprli_implies_nuprl; sp.
apply nuprl_refl in k1; sp.
rw <- iff; sp.
- repnd.
unfold equality, nuprl.
exists (fun A A' => {eqa : per(p) , close lib (univi lib i) A A' eqa}); sp.
apply CL_init.
exists (S i); simpl; left; sp; spcast; try computes_to_value_refl.
fold (@nuprli p lib i).
assert (forall x y : CTerm,
{eq : term-equality
, nuprli lib i (mkc_apply2 R1 x y) (mkc_apply2 R2 x y) eq}) as f1.
(* begin proof of the assert *)
intros.
unfold member, equality in equ0.
generalize (equ0 x y); intro k; exrepnd.
inversion k1; try not_univ.
duniv j h.
allrw @univi_exists_iff; exrepnd.
computes_to_value_isvalue; GC.
rw h0 in k0; exrepnd.
allfold (@nuprli p lib j0).
exists eqa; sp.
(* end of proof of the assert *)
generalize (choice_spteqi lib i (mkc_apply2 R1) (mkc_apply2 R2)); intro fn1.
dest_imp fn1 hyp.
exrepnd.
exists (pertype_eq f).
apply CL_ipertype.
fold (@nuprli p lib i).
unfold per_ipertype.
exists R1 R2 f;
sp; try (spcast; computes_to_value_refl); try (fold nuprl).
generalize (is_per_type_iff_is_per lib R1 f); introv iff.
dest_imp iff hyp.
intros.
generalize (fn0 x y); intro k1.
allapply @nuprli_implies_nuprl; sp.
apply nuprl_refl in k1; sp.
rw iff; sp.
Qed.
(*
(*Error: Universe inconsistency.*)
Admitted.
*)
Lemma equality_nuprli {p} :
forall lib (A B C : @CTerm p) i eq,
equality lib A B (mkc_uni i)
-> nuprli lib i A C eq
-> nuprli lib i A B eq.
Proof.
introv e n.
unfold equality, nuprl in e; exrepnd.
inversion e1; try not_univ.
duniv j h.
allrw @univi_exists_iff; exrepnd.
computes_to_value_isvalue; GC.
discover; exrepnd.
allfold (@nuprli p lib j0).
generalize (nuprli_uniquely_valued lib j0 j0 A A eqa eq); intro k.
repeat (autodimp k hyp).
apply nuprli_refl in h2; auto.
apply nuprli_refl in n; auto.
apply (nuprli_ext lib j0 A B eqa eq); auto.
Qed.
Lemma mkc_spertype_equality_in_uni {p} :
forall lib (R1 R2 : @CTerm p) i,
equality lib (mkc_spertype R1) (mkc_spertype R2) (mkc_uni i)
<=> (forall x y, equality lib (mkc_apply2 R1 x y) (mkc_apply2 R2 x y) (mkc_uni i))
# (forall x y z,
inhabited_type lib (mkc_apply2 R1 x z)
-> equality lib (mkc_apply2 R1 x y) (mkc_apply2 R1 z y) (mkc_uni i))
# (forall x y z,
inhabited_type lib (mkc_apply2 R1 y z)
-> equality lib (mkc_apply2 R1 x y) (mkc_apply2 R1 x z) (mkc_uni i))
# is_per_type lib R1.
Proof.
introv; split; intro equ; repnd.
- unfold equality, nuprl in equ; exrepnd.
inversion equ1; subst; try not_univ.
duniv j h.
allrw @univi_exists_iff; exrepnd.
computes_to_value_isvalue; GC.
rw h0 in equ0; exrepnd.
inversion equ2; subst; try not_univ.
dest_per.
allfold (@nuprl p); allfold (@nuprli p lib j0).
computes_to_value_isvalue.
dands; introv.
generalize (eqtyps1 x y); intro k.
exists eq; sp; allrw.
exists (eq1 x y); sp.
intro inh.
generalize (eqtyps1 x z); intro n.
apply inhabited_if_inhabited_type_i in n; auto.
generalize (eqtyps2 x y z n); intro ni.
exists eq; sp.
allrw; exists (eq1 x y); sp.
intro inh.
generalize (eqtyps1 y z); intro n.
apply inhabited_if_inhabited_type_i in n; auto.
generalize (eqtyps3 x y z n); intro ni.
exists eq; sp.
allrw; exists (eq1 x y); sp.
generalize (is_per_type_iff_is_per lib R0 eq1); introv iff.
dest_imp iff hyp.
intros.
generalize (eqtyps1 x y); intro k1.
allapply @nuprli_implies_nuprl; sp.
apply nuprl_refl in k1; sp.
rw <- iff; sp.
- repnd.
unfold equality, nuprl.
exists (fun A A' => {eqa : per(p) , close lib (univi lib i) A A' eqa}); sp.
apply CL_init.
exists (S i); simpl; left; sp; spcast; try computes_to_value_refl.
fold (@nuprli p lib i).
assert (forall x y : CTerm,
{eq : term-equality
, nuprli lib i (mkc_apply2 R1 x y) (mkc_apply2 R2 x y) eq}) as f1.
(* begin proof of the assert *)
intros.
unfold member, equality in equ0.
generalize (equ0 x y); intro k; exrepnd.
inversion k1; try not_univ.
duniv j h.
allrw @univi_exists_iff; exrepnd.
computes_to_value_isvalue; GC.
rw h0 in k0; exrepnd.
allfold (@nuprli p lib j0).
exists eqa; sp.
(* end of proof of the assert *)
generalize (choice_spteqi lib i (mkc_apply2 R1) (mkc_apply2 R2)); intro fn1.
dest_imp fn1 hyp.
exrepnd.
exists (pertype_eq f).
apply CL_spertype.
fold (@nuprli p lib i).
unfold per_spertype.
exists R1 R2 f;
dands; introv;
try (spcast; computes_to_value_refl);
try (fold nuprl);
try (complete sp).
intro inh.
generalize (fn0 x z); intro ni.
apply inhabited_type_if_inhabited_i in ni; auto.
generalize (equ1 x y z ni); intro e.
generalize (fn0 x y); intro n.
apply equality_nuprli with (C := mkc_apply2 R2 x y); auto.
intro inh.
generalize (fn0 y z); intro ni.
apply inhabited_type_if_inhabited_i in ni; auto.
generalize (equ2 x y z ni); intro e.
generalize (fn0 x y); intro n.
apply equality_nuprli with (C := mkc_apply2 R2 x y); auto.
generalize (is_per_type_iff_is_per lib R1 f); introv iff.
dest_imp iff hyp.
intros.
generalize (fn0 x y); intro k1.
allapply @nuprli_implies_nuprl; sp.
apply nuprl_refl in k1; sp.
rw iff; sp.
Qed.
(*
(*Error: Universe inconsistency.*)
Admitted.
*)
Lemma mkc_uni_in_nuprl {p} :
forall lib (i : nat),
nuprl lib (mkc_uni i)
(mkc_uni i)
(fun A A' => {eqa : per(p) , close lib (univi lib i) A A' eqa}).
Proof.
introv.
apply CL_init.
exists (S i); simpl.
left; sp; spcast; apply computes_to_valc_refl; sp.
Qed.
Lemma nuprl_mkc_uni {p} :
forall lib (i : nat),
{eq : per(p) , nuprl lib (mkc_uni i) (mkc_uni i) eq}.
Proof.
intros.
exists (fun A A' => {eqa : per(p) , close lib (univi lib i) A A' eqa}).
apply mkc_uni_in_nuprl.
Qed.
Lemma tequality_mkc_uni {p} :
forall lib (i : nat), @tequality p lib (mkc_uni i) (mkc_uni i).
Proof.
generalize (@nuprl_mkc_uni p); sp.
Qed.
(*
(*Error: Universe inconsistency.*)
Admitted.
*)
Lemma mkc_cequiv_equality_in_uni {p} :
forall lib (a b c d : @CTerm p) i,
equality lib (mkc_cequiv a b) (mkc_cequiv c d) (mkc_uni i)
<=>
(ccequivc lib a b <=> ccequivc lib c d).
Proof.
sp; sp_iff Case; intro e.
- Case "->".
unfold equality in e; exrepnd.
allunfold @nuprl.
inversion e1; try not_univ.
duniv j h.
allrw @univi_exists_iff; exrepnd.
computes_to_value_isvalue; GC.
rw h0 in e0; exrepnd.
inversion e2; try not_univ.
- Case "<-".
exists (fun A A' => {eqa : per(p) , close lib (univi lib i) A A' eqa}); sp.
apply CL_init.
exists (S i); simpl; left; sp;
spcast; try computes_to_value_refl.
exists (fun t t' : @CTerm p => t ===>(lib) mkc_axiom
# t' ===>(lib) mkc_axiom
# ccequivc lib a b).
apply CL_cequiv; unfold per_cequiv.
exists a b c d; sp; spcast; try computes_to_value_refl.
Qed.
(*
(*Error: Universe inconsistency.*)
Admitted.
*)
Lemma mkc_approx_equality_in_uni {p} :
forall lib (a b c d : @CTerm p) i,
equality lib (mkc_approx a b) (mkc_approx c d) (mkc_uni i)
<=>
(capproxc lib a b <=> capproxc lib c d).
Proof.
sp; sp_iff Case; intro e.
- Case "->".
unfold equality in e; exrepnd.
unfold nuprl in e1.
inversion e1; try not_univ.
duniv j h.
allrw @univi_exists_iff; exrepnd.
computes_to_value_isvalue; GC.
rw h0 in e0; exrepnd.
inversion e2; try not_univ.
- Case "<-".
exists (fun A A' => {eqa : per(p) , close lib (univi lib i) A A' eqa}); sp.
apply CL_init.
exists (S i); simpl; left; sp;
spcast; try computes_to_value_refl.
exists (fun t t' : @CTerm p => t ===>(lib) mkc_axiom
# t' ===>(lib) mkc_axiom
# capproxc lib a b).
apply CL_approx; unfold per_approx.
exists a b c d; sp; spcast; try computes_to_value_refl.
Qed.
(*
(*Error: Universe inconsistency.*)
Admitted.
*)
(*
Lemma tequality_in_uni_iff_tequality {p} :
forall (T1 T2 : @CTerm p) i,
tequality lib (mkc_member T1 (mkc_uni i))
(mkc_member T2 (mkc_uni i))
<=> equorsq T1 T2 (mkc_uni i).
Proof.
introv.
allrw <- @fold_mkc_member.
rw @tequality_mkc_equality.
split; intro k; repnd; try (complete sp).
dands; try (complete sp).
apply tequality_mkc_uni.
split; intro e.
generalize (cequorsq_equality_trans2 T1 T1 T2 (mkc_uni i)); intro e1.
repeat (dest_imp e1 hyp).
apply equality_sym in e1.
apply equality_refl in e1; sp.
generalize (cequorsq_equality_trans1 T1 T2 T2 (mkc_uni i)); intro e1.
repeat (dest_imp e1 hyp).
apply equality_refl in e1; sp.
Qed.
*)
Lemma equality_in_uni_mkc_halts {p} :
forall lib i (a b : @CTerm p),
equality lib (mkc_halts a) (mkc_halts b) (mkc_uni i)
<=>
(chaltsc lib a <=> chaltsc lib b).
Proof.
intros; repeat (rewrite <- fold_mkc_halts).
rw @mkc_approx_equality_in_uni.
allrw @chasvaluec_as_capproxc; sp.
Qed.
Lemma cequorsq_mkc_halts_implies {p} :
forall lib i (a b : @CTerm p),
equorsq lib (mkc_halts a) (mkc_halts b) (mkc_uni i)
-> (chaltsc lib a <=> chaltsc lib b).
Proof.
unfold equorsq; intros; sp;
allrw @equality_in_uni_mkc_halts; sp.
uncast; allrw @cequivc_decomp_halts; sp;
split; sp; spcast; discover; sp.
Qed.
Lemma cequorsq_mkc_halts {p} :
forall lib i (a b : @CTerm p),
equorsq lib (mkc_halts a) (mkc_halts b) (mkc_uni i)
<=>
(chaltsc lib a <=> chaltsc lib b).
Proof.
unfold equorsq; intros; split; sp; try right;
allrw @equality_in_uni_mkc_halts; sp; uncast;
allrw @cequivc_decomp_halts; try split; sp; spcast;
discover; sp.
Abort.
(* This is not true in Prop with Cast around hasvalue *)
(*Qed.*)
|
> module Data.Fin.Extensions
> import Data.Fin
> import Data.List
> import Data.List.TypeEnumeration
> embedNatAsFin : (n : Nat) -> (m : Nat) -> {pf: LT m n} -> Fin n
> embedNatAsFin Z _ {pf=_} impossible
> embedNatAsFin (S _) Z {pf = _} = FZ
> embedNatAsFin (S j) (S k) {pf = LTESucc x} = FS (embedNatAsFin j k {pf=x})
> Uninhabited (LT (S j) (S Z)) where
> uninhabited (LTESucc x) = uninhabited x
> getLesserFins : {n:Nat} -> (f : Fin (S n)) -> List (Fin (S n))
> getLesserFins FZ = FZ :: []
> getLesserFins (FS x) = (FS x) :: (getLesserFins (weaken x))
> getLesserFinsContains : (x : Fin (S k)) -> Elem x (getLesserFins (last {n = k}))
> getLesserFinsContains {k = Z} FZ = ?getLesserFinsContains_rhs_3
> getLesserFinsContains {k = Z} (FS x) impossible
> getLesserFinsContains {k = (S k)} x = ?getLesserFinsContains_rhs_2
> natToListFin' : (n : Nat) -> List (Fin (S n))
> natToListFin' t = natToListFinInternal t t {pf=lteRefl} where
> natToListFinInternal : (k:Nat) -> (l : Nat) -> {auto pf: LT (k) (S l)} -> List (Fin (S l))
> natToListFinInternal Z Z {pf = _}= [FZ]
> natToListFinInternal (S j) Z {pf} = absurd (uninhabited pf)
> natToListFinInternal (S j) m {pf} =
> let headVal = (embedNatAsFin (S m) (S j) {pf=pf}) in
> let tailVal = natToListFinInternal j m {pf = (lteSuccLeft pf)} in
> headVal :: tailVal
> safeStrengthen : (f : Fin (S n)) -> (contra : (f = last {n=n}) -> Void) -> Fin n
> safeStrengthen {n=Z} FZ contra = absurd (contra Refl)
> safeStrengthen {n=(S k)} FZ contra = FZ
> safeStrengthen {n=(S k)} (FS x) contra = ?ssh_2
> natToListFinIsAll : (n : Nat) -> All (getLesserFins (last {n=n}))
> natToListFinIsAll Z = ?isAll
> natToListFinIsAll (S k) = \f =>
> case (decEq f (last {n=(S k)})) of
> Yes pf => ?isAll1
> No contra => ?isAll2
|
lemma orthogonal_scaleR [simp]: "c \<noteq> 0 \<Longrightarrow> orthogonal (c *\<^sub>R x) = orthogonal x" |
Require Import
HoTT.Classes.interfaces.abstract_algebra
HoTT.Classes.interfaces.orders
HoTT.Classes.theory.apartness.
Generalizable Variables A.
Lemma irrefl_neq `{R : Relation A} `{!Irreflexive R}
: forall x y, R x y -> x <> y.
Proof.
intros ?? E e;rewrite e in E. apply (irreflexivity _ _ E).
Qed.
Lemma le_flip `{Le A} `{!TotalRelation (≤)} x y : ~(y ≤ x) -> x ≤ y.
Proof.
intros nle.
destruct (total _ x y) as [?|le];auto.
destruct (nle le).
Qed.
Section partial_order.
Context `{PartialOrder A}.
Lemma eq_le x y : x = y -> x ≤ y.
Proof.
intros E.
rewrite E.
apply reflexivity.
Qed.
Lemma eq_le_flip x y : x = y -> y ≤ x.
Proof.
intros E.
rewrite E.
apply reflexivity.
Qed.
Lemma not_le_ne x y : ~(x ≤ y) -> x <> y.
Proof.
intros E1 E2.
apply E1.
rewrite E2.
apply reflexivity.
Qed.
Lemma eq_iff_le x y : x = y <-> x ≤ y /\ y ≤ x.
Proof.
split; intros E.
- rewrite E. split;apply reflexivity.
- apply (antisymmetry (≤) x y);apply E.
Qed.
End partial_order.
Section strict_order.
Context `{StrictOrder A}.
Lemma lt_flip x y : x < y -> ~(y < x).
Proof.
intros E1 E2.
apply (irreflexivity (<) x).
transitivity y;assumption.
Qed.
Lemma lt_antisym x y : ~(x < y < x).
Proof.
intros [E1 E2].
destruct (lt_flip x y);assumption.
Qed.
Lemma lt_ne x y : x < y -> x <> y.
Proof.
intros E1 E2.
rewrite E2 in E1.
apply (irreflexivity (<) y). assumption.
Qed.
Lemma lt_ne_flip x y : x < y -> y <> x.
Proof.
intro.
apply symmetric_neq, lt_ne.
assumption.
Qed.
Lemma eq_not_lt x y : x = y -> ~(x < y).
Proof.
intros E.
rewrite E.
apply (irreflexivity (<)).
Qed.
End strict_order.
Section pseudo_order.
Context `{PseudoOrder A}.
Local Existing Instance pseudo_order_apart.
Lemma apart_total_lt x y : x ≶ y -> x < y |_| y < x.
Proof.
intros.
apply apart_iff_total_lt.
assumption.
Qed.
Lemma pseudo_order_lt_apart x y : x < y -> x ≶ y.
Proof.
intros.
apply apart_iff_total_lt.
auto.
Qed.
Lemma pseudo_order_lt_apart_flip x y : x < y -> y ≶ x.
Proof.
intros.
apply apart_iff_total_lt.
auto.
Qed.
Lemma not_lt_apart_lt_flip x y : ~(x < y) -> x ≶ y -> y < x.
Proof.
intros nlt neq. apply apart_iff_total_lt in neq.
destruct neq.
- destruct nlt;auto.
- auto.
Qed.
Lemma pseudo_order_cotrans_twice x₁ y₁ x₂ y₂
: x₁ < y₁ -> merely (x₂ < y₂ |_| x₁ < x₂ |_| y₂ < y₁).
Proof.
intros E1.
apply (merely_destruct (cotransitive E1 x₂));intros [?|E2];
try solve [apply tr;auto].
apply (merely_destruct (cotransitive E2 y₂));intros [?|?];apply tr;auto.
Qed.
Lemma pseudo_order_lt_ext x₁ y₁ x₂ y₂ : x₁ < y₁ ->
merely (x₂ < y₂ |_| x₁ ≶ x₂ |_| y₂ ≶ y₁).
Proof.
intros E.
apply (merely_destruct (pseudo_order_cotrans_twice x₁ y₁ x₂ y₂ E));
intros [?|[?|?]];apply tr;
auto using pseudo_order_lt_apart.
Qed.
Global Instance pseudoorder_strictorder : StrictOrder (_ : Lt A).
Proof.
split.
- apply _.
- intros x E.
destruct (pseudo_order_antisym x x); auto.
- intros x y z E1 E2.
apply (merely_destruct (cotransitive E1 z));intros [?|?]; trivial.
destruct (pseudo_order_antisym y z); auto.
Qed.
Global Instance nlt_trans : Transitive (complement (<)).
Proof.
intros x y z.
intros E1 E2 E3.
apply (merely_destruct (cotransitive E3 y));
intros [?|?]; contradiction.
Qed.
Global Instance nlt_antisymm : AntiSymmetric (complement (<)).
Proof.
intros x y H1 H2.
apply tight_apart. intros nap. apply apart_iff_total_lt in nap.
destruct nap;auto.
Qed.
Lemma ne_total_lt `{!TrivialApart A} x y : x <> y -> x < y |_| y < x.
Proof.
intros neq;apply trivial_apart in neq.
apply apart_total_lt. assumption.
Qed.
Global Instance lt_trichotomy `{!TrivialApart A} `{DecidablePaths A}
: Trichotomy (<).
Proof.
intros x y.
destruct (dec (x = y)) as [?|?]; try auto.
destruct (ne_total_lt x y); auto.
Qed.
End pseudo_order.
Section full_partial_order.
Context `{FullPartialOrder A}.
Local Existing Instance strict_po_apart.
(* Duplicate of strong_setoids.apart_ne. This is useful because a
StrongSetoid is not defined as a substructure of a FullPartialOrder *)
Instance strict_po_apart_ne x y : PropHolds (x ≶ y) -> PropHolds (x <> y).
Proof.
intros; apply _.
Qed.
Global Instance fullpartialorder_strictorder : StrictOrder (<).
Proof.
split; try apply _.
- apply strict_po_mere_lt.
- intros x. red. intros E;apply lt_iff_le_apart in E.
destruct E as [_ ?].
apply (irreflexivity (≶) x).
assumption.
Qed.
Lemma lt_le x y : PropHolds (x < y) -> PropHolds (x ≤ y).
Proof.
intro.
apply lt_iff_le_apart.
assumption.
Qed.
Lemma not_le_not_lt x y : ~(x ≤ y) -> ~(x < y).
Proof.
intros E1 E2.
apply E1. apply lt_le. assumption.
Qed.
Lemma lt_apart x y : x < y -> x ≶ y.
Proof.
intro.
apply lt_iff_le_apart.
assumption.
Qed.
Lemma lt_apart_flip x y : x < y -> y ≶ x.
Proof.
intro.
apply symmetry, lt_iff_le_apart.
assumption.
Qed.
Lemma le_not_lt_flip x y : y ≤ x -> ~(x < y).
Proof.
intros E1 E2;apply lt_iff_le_apart in E2.
destruct E2 as [E2a E2b].
revert E2b. apply tight_apart.
apply (antisymmetry (≤));assumption.
Qed.
Lemma lt_not_le_flip x y : y < x -> ~(x ≤ y).
Proof.
intros E1 E2.
apply (le_not_lt_flip y x);assumption.
Qed.
Lemma lt_le_trans x y z : x < y -> y ≤ z -> x < z.
Proof.
intros E1 E2.
apply lt_iff_le_apart. apply lt_iff_le_apart in E1.
destruct E1 as [E1a E1b].
split.
- transitivity y;assumption.
- apply (merely_destruct (cotransitive E1b z));intros [E3 | E3]; trivial.
apply lt_apart. apply symmetry in E3.
transitivity y;apply lt_iff_le_apart; auto.
Qed.
Lemma le_lt_trans x y z : x ≤ y -> y < z -> x < z.
Proof.
intros E2 E1.
apply lt_iff_le_apart. apply lt_iff_le_apart in E1.
destruct E1 as [E1a E1b].
split.
- transitivity y;auto.
- apply (merely_destruct (cotransitive E1b x));intros [E3 | E3]; trivial.
apply lt_apart. apply symmetry in E3.
transitivity y; apply lt_iff_le_apart; auto.
Qed.
Lemma lt_iff_le_ne `{!TrivialApart A} x y : x < y <-> x ≤ y /\ x <> y.
Proof.
transitivity (x <= y /\ apart x y).
- apply lt_iff_le_apart.
- split;intros [E1 E2];split;trivial;apply trivial_apart;trivial.
Qed.
Lemma le_equiv_lt `{!TrivialApart A} `{forall x y : A, Decidable (x = y)} x y
: x ≤ y -> x = y |_| x < y.
Proof.
intros.
destruct (dec (x = y)); try auto.
right.
apply lt_iff_le_ne; auto.
Qed.
Instance dec_from_lt_dec `{!TrivialApart A} `{forall x y, Decidable (x ≤ y)}
: DecidablePaths A.
Proof.
intros x y.
destruct (decide_rel (<=) x y) as [E1|E1];
[destruct (decide_rel (<=) y x) as [E2|E2]|].
- left. apply (antisymmetry (<=));assumption.
- right. intros E3;apply E2.
pattern y. apply (transport _ E3).
apply reflexivity.
- right. intros E3;apply E1.
pattern y; apply (transport _ E3).
apply reflexivity.
Defined.
Definition lt_dec_slow `{!TrivialApart A} `{forall x y, Decidable (x ≤ y)} :
forall x y, Decidable (x < y).
Proof.
intros x y.
destruct (dec (x ≤ y));
[destruct (dec (x = y))|].
- right. apply eq_not_lt. assumption.
- left. apply lt_iff_le_ne. auto.
- right. apply not_le_not_lt. assumption.
Defined.
End full_partial_order.
(* Due to bug #2528 *)
#[export]
Hint Extern 5 (PropHolds (_ <> _)) =>
eapply @strict_po_apart_ne : typeclass_instances.
#[export]
Hint Extern 10 (PropHolds (_ ≤ _)) =>
eapply @lt_le : typeclass_instances.
#[export]
Hint Extern 20 (Decidable (_ < _)) =>
eapply @lt_dec_slow : typeclass_instances.
Section full_pseudo_order.
Context `{FullPseudoOrder A}.
Local Existing Instance pseudo_order_apart.
Lemma not_lt_le_flip x y : ~(y < x) -> x ≤ y.
Proof.
intros.
apply le_iff_not_lt_flip.
assumption.
Qed.
Instance fullpseudo_partial : PartialOrder (≤) | 10.
Proof.
repeat split.
- apply _.
- apply _.
- intros x. apply not_lt_le_flip, (irreflexivity (<)).
- intros x y z E1 E2.
apply le_iff_not_lt_flip;
apply le_iff_not_lt_flip in E1;
apply le_iff_not_lt_flip in E2.
change (complement (<) z x).
transitivity y;assumption.
- intros x y E1 E2.
apply le_iff_not_lt_flip in E1;
apply le_iff_not_lt_flip in E2.
apply (antisymmetry (complement (<)));assumption.
Qed.
Lemma fullpseudo_fullpartial' : FullPartialOrder Ale Alt.
Proof.
split; try apply _.
intros x y.
split.
- intros E. split.
+ apply not_lt_le_flip. apply lt_flip;assumption.
+ apply pseudo_order_lt_apart. assumption.
- intros [? E]. apply not_lt_apart_lt_flip;[|symmetry;trivial].
apply le_iff_not_lt_flip. trivial.
Qed.
Global Instance fullpseudo_fullpartial@{i} : FullPartialOrder Ale Alt
:= ltac:(first [exact fullpseudo_fullpartial'@{i i Set Set Set}|
exact fullpseudo_fullpartial'@{i i}]).
Global Instance le_stable : forall x y, Stable (x ≤ y).
Proof.
intros x y. unfold Stable.
intros dn. apply le_iff_not_lt_flip.
intros E. apply dn.
intros E';apply le_iff_not_lt_flip in E';auto.
Qed.
Lemma le_or_lt `{!TrivialApart A} `{DecidablePaths A} x y : x ≤ y |_| y < x.
Proof.
destruct (trichotomy (<) x y) as [|[|]]; try auto.
- left. apply lt_le;trivial.
- left. apply eq_le;trivial.
Qed.
Global Instance le_total `{!TrivialApart A} `{DecidablePaths A}
: TotalOrder (≤).
Proof.
split; try apply _.
intros x y.
destruct (le_or_lt x y); auto.
right. apply lt_le.
trivial.
Qed.
Lemma not_le_lt_flip `{!TrivialApart A} `{DecidablePaths A} x y
: ~(y ≤ x) -> x < y.
Proof.
intros.
destruct (le_or_lt y x); auto.
contradiction.
Qed.
Existing Instance dec_from_lt_dec.
Definition lt_dec `{!TrivialApart A} `{forall x y, Decidable (x ≤ y)}
: forall x y, Decidable (x < y).
Proof.
intros.
destruct (decide_rel (<=) y x).
- right;apply le_not_lt_flip;assumption.
- left; apply not_le_lt_flip;assumption.
Defined.
End full_pseudo_order.
#[export]
Hint Extern 8 (Decidable (_ < _)) => eapply @lt_dec : typeclass_instances.
(*
The following instances would be tempting, but turn out to be a bad idea.
#[export]
Hint Extern 10 (PropHolds (_ <> _)) => eapply @le_ne : typeclass_instances.
#[export]
Hint Extern 10 (PropHolds (_ <> _)) => eapply @le_ne_flip : typeclass_instances.
It will then loop like:
semirings.lt_0_1 -> lt_ne_flip -> ...
*)
Section dec_strict_setoid_order.
Context `{StrictOrder A} `{Apart A} `{!TrivialApart A} `{DecidablePaths A}.
Instance: IsApart A := dec_strong_setoid.
Context `{!Trichotomy (<)}.
Instance dec_strict_pseudo_order: PseudoOrder (<).
Proof.
split; try apply _.
- intros x y [??].
destruct (lt_antisym x y); auto.
- intros x y Exy z.
destruct (trichotomy (<) x z) as [? | [Exz | Exz]];apply tr; try auto.
right. rewrite <-Exz. assumption.
- intros x y. transitivity (x <> y);[split;apply trivial_apart|].
split.
+ destruct (trichotomy (<) x y) as [?|[?|?]]; auto.
intros E;contradiction E.
+ intros [?|?];[apply lt_ne|apply lt_ne_flip];trivial.
Qed.
End dec_strict_setoid_order.
Section dec_partial_order.
Context `{PartialOrder A} `{DecidablePaths A}.
Definition dec_lt: Lt A := fun x y => x ≤ y /\ x <> y.
Context `{Alt : Lt A} `{is_mere_relation A lt}
(lt_correct : forall x y, x < y <-> x ≤ y /\ x <> y).
Instance dec_order: StrictOrder (<).
Proof.
split.
- apply _.
- intros x E. apply lt_correct in E. destruct E as [_ []];trivial.
- intros x y z E1 E2.
apply lt_correct;
apply lt_correct in E1;
apply lt_correct in E2.
destruct E1 as [E1a E1b],E2 as [E2a E2b].
split.
+ transitivity y;trivial.
+ intros E3. destruct E2b.
apply (antisymmetry (≤)); trivial.
rewrite <-E3. assumption.
Qed.
Context `{Apart A} `{!TrivialApart A}.
Instance: IsApart A := dec_strong_setoid.
Instance dec_full_partial_order: FullPartialOrder (≤) (<).
Proof.
split;try apply _.
intros. transitivity (x <= y /\ x <> y);[|
split;intros [? ?];split;trivial;apply trivial_apart;trivial].
apply lt_correct.
Qed.
Context `{!TotalRelation (≤)}.
Instance: Trichotomy (<).
Proof.
intros x y.
destruct (dec (x = y)); try auto.
destruct (total (≤) x y);[left|right;right];
apply lt_correct;auto.
split;auto.
intro E;apply symmetry in E;auto.
Qed.
Instance dec_pseudo_order: PseudoOrder (<) := dec_strict_pseudo_order.
Instance dec_full_pseudo_order: FullPseudoOrder (≤) (<).
Proof.
split; try apply _.
intros x y.
split.
- intros ? E. apply lt_correct in E;destruct E as [? []].
apply (antisymmetry (≤));assumption.
- intros E1.
destruct (total (≤) x y); trivial.
destruct (dec (x = y)) as [E2|E2].
+ rewrite E2. apply reflexivity.
+ destruct E1. apply lt_correct;split;auto.
apply symmetric_neq;assumption.
Qed.
End dec_partial_order.
Lemma lt_eq_trans `{Lt A} : forall x y z, x < y -> y = z -> x < z.
Proof.
intros ???? [];trivial.
Qed.
Section pseudo.
Context {A : Type}.
Context `{PseudoOrder A}.
Lemma nlt_lt_trans {x y z : A} : ~ (y < x) -> y < z -> x < z.
Proof.
intros nltyx ltyz.
assert (disj := cotransitive ltyz x).
strip_truncations.
destruct disj as [ltyx|ltxz].
- destruct (nltyx ltyx).
- exact ltxz.
Qed.
Lemma lt_nlt_trans {x y z : A} : x < y -> ~ (z < y) -> x < z.
Proof.
intros ltxy nltzy.
assert (disj := cotransitive ltxy z).
strip_truncations.
destruct disj as [ltxz|ltzy].
- exact ltxz.
- destruct (nltzy ltzy).
Qed.
Lemma lt_transitive : Transitive (_ : Lt A).
Proof.
intros x y z ltxy ltyz.
assert (ltxyz := cotransitive ltxy z).
strip_truncations.
destruct ltxyz as [ltxz|ltzy].
- assumption.
- destruct (pseudo_order_antisym y z (ltyz , ltzy)).
Qed.
Global Existing Instance lt_transitive.
End pseudo.
|
# 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
#' CommentAddedMessagePayload Class
#'
#' @field comment
#'
#' @importFrom R6 R6Class
#' @importFrom jsonlite fromJSON toJSON
#' @export
CommentAddedMessagePayload <- R6::R6Class(
'CommentAddedMessagePayload',
public = list(
`comment` = NULL,
initialize = function(`comment`){
if (!missing(`comment`)) {
stopifnot(R6::is.R6(`comment`))
self$`comment` <- `comment`
}
},
toJSON = function() {
CommentAddedMessagePayloadObject <- list()
if (!is.null(self$`comment`)) {
CommentAddedMessagePayloadObject[['comment']] <- self$`comment`$toJSON()
}
CommentAddedMessagePayloadObject
},
fromJSON = function(CommentAddedMessagePayloadJson) {
CommentAddedMessagePayloadObject <- dlensFromJSON(CommentAddedMessagePayloadJson)
if (!is.null(CommentAddedMessagePayloadObject$`comment`)) {
commentObject <- Comment$new()
commentObject$fromJSON(jsonlite::toJSON(CommentAddedMessagePayloadObject$comment, auto_unbox = TRUE))
self$`comment` <- commentObject
}
},
toJSONString = function() {
sprintf(
'{
"comment": %s
}',
self$`comment`$toJSON()
)
},
fromJSONString = function(CommentAddedMessagePayloadJson) {
CommentAddedMessagePayloadObject <- dlensFromJSON(CommentAddedMessagePayloadJson)
CommentObject <- Comment$new()
self$`comment` <- CommentObject$fromJSON(jsonlite::toJSON(CommentAddedMessagePayloadObject$comment, auto_unbox = TRUE))
}
)
)
|
(* *********************************************************************
Theory RG.thy is part of a framework for modelling,
verification and transformation of concurrent imperative
programs. Copyright (c) 2021 M. Bortin
The framework 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.
For more details see the license agreement (LICENSE) you should have
received along with the framework.
******************************************************************* *)
theory RG
imports Computations
begin
section "Extended Hoare-triples"
definition HoareTripleRG :: "(nat \<Rightarrow> 's LA) \<Rightarrow> 's staterel \<Rightarrow> 's set \<Rightarrow> 's LA \<Rightarrow>
's set \<Rightarrow> 's staterel \<Rightarrow> bool"
("_ \<Turnstile> {_ , _} _ {_ , _}" [40, 20, 20, 71, 20, 20] 71)
where "\<rho> \<Turnstile> {R, P} p {Q, G} =
(EnvCond \<rho> R \<inter> InitCond \<rho> P \<inter> \<lbrakk>p\<rbrakk>\<^sub>\<rho> \<subseteq> TermCond \<rho> Q \<inter> ProgCond \<rho> G)"
definition HoareTripleRG2 :: "(nat \<Rightarrow> 's LA) \<Rightarrow> 's staterel \<Rightarrow> 's staterel \<Rightarrow>
's LA \<Rightarrow>
's staterel \<Rightarrow> 's staterel \<Rightarrow> bool"
("_ \<Turnstile>\<^sub>2 {_ , _} _ {_ , _}" [40, 20, 20, 71, 20, 20] 71)
where "\<rho> \<Turnstile>\<^sub>2 {R, P} p {Q, G} = (\<forall>\<sigma>. \<rho> \<Turnstile> {R, P `` {\<sigma>}} p {Q `` {\<sigma>}, G})"
abbreviation HoareTripleRGjf :: "'s staterel \<Rightarrow> 's set \<Rightarrow> 's LA \<Rightarrow>
's set \<Rightarrow> 's staterel \<Rightarrow> bool"
(" \<Turnstile> {_ , _} _ {_ , _}" [20, 20, 71, 20, 20] 71)
where "\<Turnstile> {R, P} p {Q, G} \<equiv> (\<lambda>x. Skip) \<Turnstile> {R, P} p {Q, G}"
abbreviation HoareTripleRG2jf :: "'s staterel \<Rightarrow> 's staterel \<Rightarrow>
's LA \<Rightarrow>
's staterel \<Rightarrow> 's staterel \<Rightarrow> bool"
("\<Turnstile>\<^sub>2 {_ , _} _ {_ , _}" [20, 20, 71, 20, 20] 71)
where "\<Turnstile>\<^sub>2 {R, P} p {Q, G} \<equiv> (\<lambda>x. Skip) \<Turnstile>\<^sub>2 {R, P} p {Q, G}"
lemma HoareTripleRG_subset_eq :
"\<rho> \<Turnstile> {R, P} p {Q, G} =
(\<forall>P' \<subseteq> P. \<rho> \<Turnstile> {R, P'} p {Q, G})"
apply(rule iffI)
apply clarify
apply(subst HoareTripleRG_def)
apply clarify
apply(rename_tac sq)
apply(subst (asm) HoareTripleRG_def)
apply(erule subsetD, simp add: InitCond_def)
apply fastforce
apply(drule spec, drule mp, rule subset_refl)
by assumption
lemma HoareTripleRG_singleton_eq :
"\<rho> \<Turnstile> {R, P} p {Q, G} =
(\<forall>s \<in> P. \<rho> \<Turnstile> {R, {s}} p {Q, G})"
apply(rule iffI)
apply clarify
apply(subst (asm) HoareTripleRG_subset_eq)
apply(drule spec, erule mp, clarsimp)
apply(subst HoareTripleRG_def)
apply clarify
apply(rename_tac sq)
apply(clarsimp simp: InitCond_def)
apply(drule_tac x="s" in bspec)
apply(subst (asm) hd_conv_nth, erule pcs_noNil)
apply simp
apply(subst (asm) HoareTripleRG_def)
apply(drule_tac c=sq in subsetD, simp add: InitCond_def, erule exI)
apply clarsimp
done
subsection "Properties of finite and infinite computations"
definition HoareTripleRG_i :: "(nat \<Rightarrow> 's LA) \<Rightarrow> 's staterel \<Rightarrow> 's set \<Rightarrow> 's LA \<Rightarrow>
's set \<Rightarrow> 's staterel \<Rightarrow> bool"
("_ \<Turnstile>i {_ , _} _ {_ , _}" [40, 20, 20, 71, 20, 20] 71)
where "\<rho> \<Turnstile>i {R, P} p {Q, G} \<equiv>
(EnvCond \<rho> R \<inter> InitCond \<rho> P \<inter> \<lbrakk>p\<rbrakk>\<^sub>\<rho> \<subseteq> TermCond \<rho> Q \<inter> ProgCond \<rho> G) \<and>
(EnvCond_i \<rho> R \<inter> InitCond_i \<rho> P \<inter> iCOMP \<rho> \<inter> {sq. progOf(sq 0) = p} \<subseteq>
TermCond_i \<rho> Q \<inter> ProgCond_i \<rho> G)"
abbreviation HoareTripleRGjf_i :: "'s staterel \<Rightarrow> 's set \<Rightarrow> 's LA \<Rightarrow>
's set \<Rightarrow> 's staterel \<Rightarrow> bool"
("\<Turnstile>i {_ , _} _ {_ , _}" [20, 20, 71, 20, 20] 71)
where "\<Turnstile>i {R, P} p {Q, G} \<equiv> (\<lambda>x. Skip) \<Turnstile>i {R, P} p {Q, G}"
theorem HoareTripleRG_i :
"\<rho> \<Turnstile> {R, P} p {Q, G} \<Longrightarrow>
\<rho> \<Turnstile>i {R, P} p {Q, G}"
apply(subst HoareTripleRG_i_def)
apply(rule conjI)
apply(simp add: HoareTripleRG_def)
apply clarify
apply(rename_tac isq)
apply simp
apply(case_tac "isq 0", clarsimp)
apply(rename_tac s0 tk0)
apply(subgoal_tac "\<forall>j. fprefix isq j \<in> TermCond \<rho> Q \<inter> ProgCond \<rho> G")
apply(rule conjI)
apply(clarsimp simp: TermCond_i_def)
apply(drule_tac x=j in spec, clarify)
apply(drule TermCond_D)
apply(simp add: fprefix_length)
apply(drule_tac x=j in spec, clarsimp simp: fprefix_nth)
apply fast
apply(clarsimp simp: ProgCond_i_def cstep_cond_def)
apply(drule_tac x=i in spec, clarify)
apply(erule_tac i=i in ProgCond_D)
apply(simp add: fprefix_length)
apply assumption
apply(simp add: fprefix_nth)
apply(erule sym)
apply(simp add: fprefix_nth)
apply(rule allI)
apply(frule_tac n=j in fprefix_COMP)
apply(subst (asm) HoareTripleRG_def)
apply(drule_tac c="fprefix isq j" in subsetD)
apply simp
apply(rule conjI)
apply(simp add: EnvCond_def)
apply(rule conjI)
apply(rule_tac x="progOf(isq 0)" in exI, simp add: pcs_def)
apply(subst hd_conv_nth, erule COMP_noNil)
apply(simp add: fprefix_nth)
apply(clarsimp simp: fprefix_length fprefix_nth)
apply(clarsimp simp: EnvCond_i_def)
apply(rule conjI)
apply(simp add: InitCond_def)
apply(rule conjI)
apply(rule_tac x="progOf(isq 0)" in exI, simp add: pcs_def)
apply(subst hd_conv_nth, erule COMP_noNil)
apply(simp add: fprefix_nth)
apply(subst hd_conv_nth, erule COMP_noNil)
apply(simp add: fprefix_nth InitCond_i_def)
apply(simp add: pcs_def)
apply(subst hd_conv_nth, erule COMP_noNil)
apply(simp add: fprefix_nth)
by assumption
section "Syntactic sugaring"
syntax
"_rg" :: "(nat \<Rightarrow> 's LA) \<Rightarrow> 's LA \<Rightarrow> 's staterel \<Rightarrow> 's set \<Rightarrow> 's set \<Rightarrow>'s staterel \<Rightarrow> bool"
("(4_)/ \<Turnstile> _//RELY _//PRE _//POST _//GUAR _" [60,0,0,0,0] 45)
translations
"_rg \<rho> p R P Q G" \<rightharpoonup> "\<rho> \<Turnstile> {R, P} p {Q, G}"
ML \<open> val syntax_debug = false \<close>
print_translation \<open>
let
fun rg_tr (rho :: R :: P :: p :: Q :: G :: ts) =
let val _ = if syntax_debug then writeln "rg" else ()
in Syntax.const @{syntax_const "_rg"} $
rho $ p $ R $ P $ Q $ G
end
| rg_tr x = let val _ = writeln (@{make_string} {x = x})
in raise Match end;
in
[(@{const_syntax HoareTripleRG}, K rg_tr)]
end
\<close>
syntax
"_rgjf" :: "'s LA \<Rightarrow> 's staterel \<Rightarrow> 's set \<Rightarrow> 's set \<Rightarrow>'s staterel \<Rightarrow> bool"
("\<Turnstile> _//RELY _//PRE _//POST _//GUAR _" [0,0,0,0] 45)
translations
"_rgjf p R P Q G" \<rightharpoonup> "\<Turnstile> {R, P} p {Q, G}"
print_translation \<open>
let
fun rgjf_tr (R :: P :: p :: Q :: G :: ts) =
let val _ = if syntax_debug then writeln "rgjf" else ()
in Syntax.const @{syntax_const "_rgjf"} $
p $ R $ P $ Q $ G
end
| rgjf_tr x = let val _ = writeln (@{make_string} {x = x})
in raise Match end;
in
[(@{const_syntax HoareTripleRGjf}, K rgjf_tr)]
end
\<close>
syntax
"_rgi" :: "(nat \<Rightarrow> 's LA) \<Rightarrow> 's LA \<Rightarrow> 's staterel \<Rightarrow> 's set \<Rightarrow> 's set \<Rightarrow>'s staterel \<Rightarrow> bool"
("(4_)/ \<Turnstile>i _//RELY _//PRE _//POST _//GUAR _" [60,0,0,0,0] 45)
translations
"_rgi \<rho> p R P Q G" \<rightharpoonup> "\<rho> \<Turnstile>i {R, P} p {Q, G}"
print_translation \<open>
let
fun rgi_tr (rho :: R :: P :: p :: Q :: G :: ts) =
let val _ = if syntax_debug then writeln "rgi" else ()
in Syntax.const @{syntax_const "_rgi"} $
rho $ p $ R $ P $ Q $ G
end
| rgi_tr x = let val _ = writeln (@{make_string} {x = x})
in raise Match end;
in
[(@{const_syntax HoareTripleRG_i}, K rgi_tr)]
end
\<close>
syntax
"_rgijf" :: "'s LA \<Rightarrow> 's staterel \<Rightarrow> 's set \<Rightarrow> 's set \<Rightarrow>'s staterel \<Rightarrow> bool"
("\<Turnstile>i _//RELY _//PRE _//POST _//GUAR _" [0,0,0,0] 45)
translations
"_rgijf p R P Q G" \<rightharpoonup> "\<Turnstile>i {R, P} p {Q, G}"
print_translation \<open>
let
fun rgijf_tr (R :: P :: p :: Q :: G :: ts) =
let val _ = if syntax_debug then writeln "rgijf" else ()
in Syntax.const @{syntax_const "_rgijf"} $
p $ R $ P $ Q $ G
end
| rgijf_tr x = let val _ = writeln (@{make_string} {x = x})
in raise Match end;
in
[(@{const_syntax HoareTripleRGjf_i}, K rgijf_tr)]
end
\<close>
syntax
"_rg2" :: "(nat \<Rightarrow> 's LA) \<Rightarrow> 's LA \<Rightarrow> 's staterel \<Rightarrow>
's staterel \<Rightarrow> 's staterel \<Rightarrow> 's staterel \<Rightarrow> bool"
("(4_)/ \<Turnstile>\<^sub>2 _//RELY _//PRE _//POST _//GUAR _" [60,0,0,0,0] 45)
translations
"_rg2 \<rho> p R P Q G" \<rightharpoonup> "\<rho> \<Turnstile>\<^sub>2 {R, P} p {Q, G}"
ML \<open> val syntax_debug = false \<close>
print_translation \<open> let
fun rg2_tr (rho :: R :: P :: p :: Q :: G :: ts) =
let val _ = if syntax_debug then writeln "rg2" else ()
in Syntax.const @{syntax_const "_rg2"} $
rho $ p $ R $ P $ Q $ G
end
| rg2_tr x = let val _ = writeln (@{make_string} {x = x})
in raise Match end;
in
[(@{const_syntax HoareTripleRG2}, K rg2_tr)]
end
\<close>
syntax
"_rg2jf" :: "'s LA \<Rightarrow> 's staterel \<Rightarrow>
's staterel \<Rightarrow> 's staterel \<Rightarrow> 's staterel \<Rightarrow> bool"
("\<Turnstile>\<^sub>2 _//RELY _//PRE _//POST _//GUAR _" [0,0,0,0] 45)
translations
"_rg2jf p R P Q G" \<rightharpoonup> "\<Turnstile>\<^sub>2 {R, P} p {Q, G}"
print_translation \<open> let
fun rg2jf_tr (R :: P :: p :: Q :: G :: ts) =
let val _ = if syntax_debug then writeln "rg2jf" else ()
in Syntax.const @{syntax_const "_rg2jf"} $
p $ R $ P $ Q $ G
end
| rg2jf_tr x = let val _ = writeln (@{make_string} {x = x})
in raise Match end;
in
[(@{const_syntax HoareTripleRG2jf}, K rg2jf_tr)]
end
\<close>
end
|
[GOAL]
⊢ Set.Nonempty (interior { carrier := Icc 0 1, isCompact' := (_ : IsCompact (Icc 0 1)) }.carrier)
[PROOFSTEP]
simp_rw [interior_Icc, nonempty_Ioo, zero_lt_one]
[GOAL]
ι : Type u_1
inst✝ : Fintype ι
⊢ Set.Nonempty
(interior
{ carrier := Set.pi univ fun x => Icc 0 1, isCompact' := (_ : IsCompact (Set.pi univ fun x => Icc 0 1)) }.carrier)
[PROOFSTEP]
simp only [interior_pi_set, Set.toFinite, interior_Icc, univ_pi_nonempty_iff, nonempty_Ioo, imp_true_iff, zero_lt_one]
[GOAL]
ι : Type u_1
inst✝ : Fintype ι
⊢ ↑(parallelepiped (Pi.basisFun ℝ ι)) = ↑(PositiveCompacts.piIcc01 ι)
[PROOFSTEP]
refine' Eq.trans _ ((uIcc_of_le _).trans (Set.pi_univ_Icc _ _).symm)
[GOAL]
case refine'_1
ι : Type u_1
inst✝ : Fintype ι
⊢ ↑(parallelepiped (Pi.basisFun ℝ ι)) = uIcc (fun i => 0) fun i => 1
[PROOFSTEP]
classical convert parallelepiped_single (ι := ι) 1
[GOAL]
case refine'_1
ι : Type u_1
inst✝ : Fintype ι
⊢ ↑(parallelepiped (Pi.basisFun ℝ ι)) = uIcc (fun i => 0) fun i => 1
[PROOFSTEP]
convert parallelepiped_single (ι := ι) 1
[GOAL]
case refine'_2
ι : Type u_1
inst✝ : Fintype ι
⊢ (fun i => 0) ≤ fun i => 1
[PROOFSTEP]
exact zero_le_one
[GOAL]
⊢ addHaarMeasure Icc01 = volume
[PROOFSTEP]
convert (addHaarMeasure_unique volume Icc01).symm
[GOAL]
case h.e'_2
⊢ addHaarMeasure Icc01 = ↑↑volume ↑Icc01 • addHaarMeasure Icc01
[PROOFSTEP]
simp [Icc01]
[GOAL]
ι : Type u_1
inst✝ : Fintype ι
⊢ addHaarMeasure (piIcc01 ι) = volume
[PROOFSTEP]
convert (addHaarMeasure_unique volume (piIcc01 ι)).symm
[GOAL]
case h.e'_2
ι : Type u_1
inst✝ : Fintype ι
⊢ addHaarMeasure (piIcc01 ι) = ↑↑volume ↑(piIcc01 ι) • addHaarMeasure (piIcc01 ι)
[PROOFSTEP]
simp only [piIcc01, volume_pi_pi fun _ => Icc (0 : ℝ) 1, PositiveCompacts.coe_mk, Compacts.coe_mk,
Finset.prod_const_one, ENNReal.ofReal_one, Real.volume_Icc, one_smul, sub_zero]
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
sb : Metric.Bounded s
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
⊢ ↑↑μ s = 0
[PROOFSTEP]
by_contra h
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
sb : Metric.Bounded s
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
h : ¬↑↑μ s = 0
⊢ False
[PROOFSTEP]
apply lt_irrefl ∞
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
sb : Metric.Bounded s
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
h : ¬↑↑μ s = 0
⊢ ⊤ < ⊤
[PROOFSTEP]
calc
∞ = ∑' _ : ℕ, μ s := (ENNReal.tsum_const_eq_top_of_ne_zero h).symm
_ = ∑' n : ℕ, μ ({u n} + s) := by congr 1; ext1 n; simp only [image_add_left, measure_preimage_add, singleton_add]
_ = μ (⋃ n, {u n} + s) :=
(Eq.symm <|
measure_iUnion hs fun n => by simpa only [image_add_left, singleton_add] using measurable_id.const_add _ h's)
_ = μ (range u + s) := by rw [← iUnion_add, iUnion_singleton_eq_range]
_ < ∞ := Bounded.measure_lt_top (hu.add sb)
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
sb : Metric.Bounded s
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
h : ¬↑↑μ s = 0
⊢ ∑' (x : ℕ), ↑↑μ s = ∑' (n : ℕ), ↑↑μ ({u n} + s)
[PROOFSTEP]
congr 1
[GOAL]
case e_f
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
sb : Metric.Bounded s
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
h : ¬↑↑μ s = 0
⊢ (fun x => ↑↑μ s) = fun n => ↑↑μ ({u n} + s)
[PROOFSTEP]
ext1 n
[GOAL]
case e_f.h
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
sb : Metric.Bounded s
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
h : ¬↑↑μ s = 0
n : ℕ
⊢ ↑↑μ s = ↑↑μ ({u n} + s)
[PROOFSTEP]
simp only [image_add_left, measure_preimage_add, singleton_add]
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
sb : Metric.Bounded s
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
h : ¬↑↑μ s = 0
n : ℕ
⊢ MeasurableSet ({u n} + s)
[PROOFSTEP]
simpa only [image_add_left, singleton_add] using measurable_id.const_add _ h's
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
sb : Metric.Bounded s
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
h : ¬↑↑μ s = 0
⊢ ↑↑μ (⋃ (n : ℕ), {u n} + s) = ↑↑μ (range u + s)
[PROOFSTEP]
rw [← iUnion_add, iUnion_singleton_eq_range]
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
⊢ ↑↑μ s = 0
[PROOFSTEP]
suffices H : ∀ R, μ (s ∩ closedBall 0 R) = 0
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
H : ∀ (R : ℝ), ↑↑μ (s ∩ closedBall 0 R) = 0
⊢ ↑↑μ s = 0
[PROOFSTEP]
apply le_antisymm _ (zero_le _)
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
H : ∀ (R : ℝ), ↑↑μ (s ∩ closedBall 0 R) = 0
⊢ ↑↑μ s ≤ 0
[PROOFSTEP]
calc
μ s ≤ ∑' n : ℕ, μ (s ∩ closedBall 0 n) :=
by
conv_lhs => rw [← iUnion_inter_closedBall_nat s 0]
exact measure_iUnion_le _
_ = 0 := by simp only [H, tsum_zero]
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
H : ∀ (R : ℝ), ↑↑μ (s ∩ closedBall 0 R) = 0
⊢ ↑↑μ s ≤ ∑' (n : ℕ), ↑↑μ (s ∩ closedBall 0 ↑n)
[PROOFSTEP]
conv_lhs => rw [← iUnion_inter_closedBall_nat s 0]
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
H : ∀ (R : ℝ), ↑↑μ (s ∩ closedBall 0 R) = 0
| ↑↑μ s
[PROOFSTEP]
rw [← iUnion_inter_closedBall_nat s 0]
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
H : ∀ (R : ℝ), ↑↑μ (s ∩ closedBall 0 R) = 0
| ↑↑μ s
[PROOFSTEP]
rw [← iUnion_inter_closedBall_nat s 0]
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
H : ∀ (R : ℝ), ↑↑μ (s ∩ closedBall 0 R) = 0
| ↑↑μ s
[PROOFSTEP]
rw [← iUnion_inter_closedBall_nat s 0]
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
H : ∀ (R : ℝ), ↑↑μ (s ∩ closedBall 0 R) = 0
⊢ ↑↑μ (⋃ (n : ℕ), s ∩ closedBall 0 ↑n) ≤ ∑' (n : ℕ), ↑↑μ (s ∩ closedBall 0 ↑n)
[PROOFSTEP]
exact measure_iUnion_le _
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
H : ∀ (R : ℝ), ↑↑μ (s ∩ closedBall 0 R) = 0
⊢ ∑' (n : ℕ), ↑↑μ (s ∩ closedBall 0 ↑n) = 0
[PROOFSTEP]
simp only [H, tsum_zero]
[GOAL]
case H
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
⊢ ∀ (R : ℝ), ↑↑μ (s ∩ closedBall 0 R) = 0
[PROOFSTEP]
intro R
[GOAL]
case H
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
R : ℝ
⊢ ↑↑μ (s ∩ closedBall 0 R) = 0
[PROOFSTEP]
apply
addHaar_eq_zero_of_disjoint_translates_aux μ u (bounded_closedBall.mono (inter_subset_right _ _)) hu _
(h's.inter measurableSet_closedBall)
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
R : ℝ
⊢ Pairwise (Disjoint on fun n => {u n} + s ∩ closedBall 0 R)
[PROOFSTEP]
refine pairwise_disjoint_mono hs fun n => ?_
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Set E
u : ℕ → E
hu : Metric.Bounded (range u)
hs : Pairwise (Disjoint on fun n => {u n} + s)
h's : MeasurableSet s
R : ℝ
n : ℕ
⊢ {u n} + s ∩ closedBall 0 R ≤ {u n} + s
[PROOFSTEP]
exact add_subset_add Subset.rfl (inter_subset_left _ _)
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
⊢ ↑↑μ ↑s = 0
[PROOFSTEP]
obtain ⟨x, hx⟩ : ∃ x, x ∉ s := by simpa only [Submodule.eq_top_iff', not_exists, Ne.def, not_forall] using hs
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
⊢ ∃ x, ¬x ∈ s
[PROOFSTEP]
simpa only [Submodule.eq_top_iff', not_exists, Ne.def, not_forall] using hs
[GOAL]
case intro
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
⊢ ↑↑μ ↑s = 0
[PROOFSTEP]
obtain ⟨c, cpos, cone⟩ : ∃ c : ℝ, 0 < c ∧ c < 1 := ⟨1 / 2, by norm_num, by norm_num⟩
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
⊢ 0 < 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
⊢ 1 / 2 < 1
[PROOFSTEP]
norm_num
[GOAL]
case intro.intro.intro
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
c : ℝ
cpos : 0 < c
cone : c < 1
⊢ ↑↑μ ↑s = 0
[PROOFSTEP]
have A : Bounded (range fun n : ℕ => c ^ n • x) :=
haveI : Tendsto (fun n : ℕ => c ^ n • x) atTop (𝓝 ((0 : ℝ) • x)) :=
(tendsto_pow_atTop_nhds_0_of_lt_1 cpos.le cone).smul_const x
bounded_range_of_tendsto _ this
[GOAL]
case intro.intro.intro
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
c : ℝ
cpos : 0 < c
cone : c < 1
A : Metric.Bounded (range fun n => c ^ n • x)
⊢ ↑↑μ ↑s = 0
[PROOFSTEP]
apply addHaar_eq_zero_of_disjoint_translates μ _ A _ (Submodule.closed_of_finiteDimensional s).measurableSet
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
c : ℝ
cpos : 0 < c
cone : c < 1
A : Metric.Bounded (range fun n => c ^ n • x)
⊢ Pairwise (Disjoint on fun n => {c ^ n • x} + ↑s)
[PROOFSTEP]
intro m n hmn
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
c : ℝ
cpos : 0 < c
cone : c < 1
A : Metric.Bounded (range fun n => c ^ n • x)
m n : ℕ
hmn : m ≠ n
⊢ (Disjoint on fun n => {c ^ n • x} + ↑s) m n
[PROOFSTEP]
simp only [Function.onFun, image_add_left, singleton_add, disjoint_left, mem_preimage, SetLike.mem_coe]
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
c : ℝ
cpos : 0 < c
cone : c < 1
A : Metric.Bounded (range fun n => c ^ n • x)
m n : ℕ
hmn : m ≠ n
⊢ ∀ ⦃a : E⦄, -(c ^ m • x) + a ∈ s → ¬-(c ^ n • x) + a ∈ s
[PROOFSTEP]
intro y hym hyn
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
c : ℝ
cpos : 0 < c
cone : c < 1
A : Metric.Bounded (range fun n => c ^ n • x)
m n : ℕ
hmn : m ≠ n
y : E
hym : -(c ^ m • x) + y ∈ s
hyn : -(c ^ n • x) + y ∈ s
⊢ False
[PROOFSTEP]
have A : (c ^ n - c ^ m) • x ∈ s := by
convert s.sub_mem hym hyn using 1
simp only [sub_smul, neg_sub_neg, add_sub_add_right_eq_sub]
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
c : ℝ
cpos : 0 < c
cone : c < 1
A : Metric.Bounded (range fun n => c ^ n • x)
m n : ℕ
hmn : m ≠ n
y : E
hym : -(c ^ m • x) + y ∈ s
hyn : -(c ^ n • x) + y ∈ s
⊢ (c ^ n - c ^ m) • x ∈ s
[PROOFSTEP]
convert s.sub_mem hym hyn using 1
[GOAL]
case h.e'_4
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
c : ℝ
cpos : 0 < c
cone : c < 1
A : Metric.Bounded (range fun n => c ^ n • x)
m n : ℕ
hmn : m ≠ n
y : E
hym : -(c ^ m • x) + y ∈ s
hyn : -(c ^ n • x) + y ∈ s
⊢ (c ^ n - c ^ m) • x = -(c ^ m • x) + y - (-(c ^ n • x) + y)
[PROOFSTEP]
simp only [sub_smul, neg_sub_neg, add_sub_add_right_eq_sub]
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
c : ℝ
cpos : 0 < c
cone : c < 1
A✝ : Metric.Bounded (range fun n => c ^ n • x)
m n : ℕ
hmn : m ≠ n
y : E
hym : -(c ^ m • x) + y ∈ s
hyn : -(c ^ n • x) + y ∈ s
A : (c ^ n - c ^ m) • x ∈ s
⊢ False
[PROOFSTEP]
have H : c ^ n - c ^ m ≠ 0 := by simpa only [sub_eq_zero, Ne.def] using (strictAnti_pow cpos cone).injective.ne hmn.symm
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
c : ℝ
cpos : 0 < c
cone : c < 1
A✝ : Metric.Bounded (range fun n => c ^ n • x)
m n : ℕ
hmn : m ≠ n
y : E
hym : -(c ^ m • x) + y ∈ s
hyn : -(c ^ n • x) + y ∈ s
A : (c ^ n - c ^ m) • x ∈ s
⊢ c ^ n - c ^ m ≠ 0
[PROOFSTEP]
simpa only [sub_eq_zero, Ne.def] using (strictAnti_pow cpos cone).injective.ne hmn.symm
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
c : ℝ
cpos : 0 < c
cone : c < 1
A✝ : Metric.Bounded (range fun n => c ^ n • x)
m n : ℕ
hmn : m ≠ n
y : E
hym : -(c ^ m • x) + y ∈ s
hyn : -(c ^ n • x) + y ∈ s
A : (c ^ n - c ^ m) • x ∈ s
H : c ^ n - c ^ m ≠ 0
⊢ False
[PROOFSTEP]
have : x ∈ s := by
convert s.smul_mem (c ^ n - c ^ m)⁻¹ A
rw [smul_smul, inv_mul_cancel H, one_smul]
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
c : ℝ
cpos : 0 < c
cone : c < 1
A✝ : Metric.Bounded (range fun n => c ^ n • x)
m n : ℕ
hmn : m ≠ n
y : E
hym : -(c ^ m • x) + y ∈ s
hyn : -(c ^ n • x) + y ∈ s
A : (c ^ n - c ^ m) • x ∈ s
H : c ^ n - c ^ m ≠ 0
⊢ x ∈ s
[PROOFSTEP]
convert s.smul_mem (c ^ n - c ^ m)⁻¹ A
[GOAL]
case h.e'_4
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
c : ℝ
cpos : 0 < c
cone : c < 1
A✝ : Metric.Bounded (range fun n => c ^ n • x)
m n : ℕ
hmn : m ≠ n
y : E
hym : -(c ^ m • x) + y ∈ s
hyn : -(c ^ n • x) + y ∈ s
A : (c ^ n - c ^ m) • x ∈ s
H : c ^ n - c ^ m ≠ 0
⊢ x = (c ^ n - c ^ m)⁻¹ • (c ^ n - c ^ m) • x
[PROOFSTEP]
rw [smul_smul, inv_mul_cancel H, one_smul]
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : Submodule ℝ E
hs : s ≠ ⊤
x : E
hx : ¬x ∈ s
c : ℝ
cpos : 0 < c
cone : c < 1
A✝ : Metric.Bounded (range fun n => c ^ n • x)
m n : ℕ
hmn : m ≠ n
y : E
hym : -(c ^ m • x) + y ∈ s
hyn : -(c ^ n • x) + y ∈ s
A : (c ^ n - c ^ m) • x ∈ s
H : c ^ n - c ^ m ≠ 0
this : x ∈ s
⊢ False
[PROOFSTEP]
exact hx this
[GOAL]
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : AffineSubspace ℝ E
hs : s ≠ ⊤
⊢ ↑↑μ ↑s = 0
[PROOFSTEP]
rcases s.eq_bot_or_nonempty with (rfl | hne)
[GOAL]
case inl
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
hs : ⊥ ≠ ⊤
⊢ ↑↑μ ↑⊥ = 0
[PROOFSTEP]
rw [AffineSubspace.bot_coe, measure_empty]
[GOAL]
case inr
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : AffineSubspace ℝ E
hs : s ≠ ⊤
hne : Set.Nonempty ↑s
⊢ ↑↑μ ↑s = 0
[PROOFSTEP]
rw [Ne.def, ← AffineSubspace.direction_eq_top_iff_of_nonempty hne] at hs
[GOAL]
case inr
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : AffineSubspace ℝ E
hs : ¬AffineSubspace.direction s = ⊤
hne : Set.Nonempty ↑s
⊢ ↑↑μ ↑s = 0
[PROOFSTEP]
rcases hne with ⟨x, hx : x ∈ s⟩
[GOAL]
case inr.intro
E : Type u_1
inst✝⁵ : NormedAddCommGroup E
inst✝⁴ : NormedSpace ℝ E
inst✝³ : MeasurableSpace E
inst✝² : BorelSpace E
inst✝¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
s : AffineSubspace ℝ E
hs : ¬AffineSubspace.direction s = ⊤
x : E
hx : x ∈ s
⊢ ↑↑μ ↑s = 0
[PROOFSTEP]
simpa only [AffineSubspace.coe_direction_eq_vsub_set_right hx, vsub_eq_sub, sub_eq_add_neg, image_add_right, neg_neg,
measure_preimage_add_right] using addHaar_submodule μ s.direction hs
[GOAL]
ι : Type u_1
inst✝¹ : Finite ι
f : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det f ≠ 0
μ : Measure (ι → ℝ)
inst✝ : IsAddHaarMeasure μ
⊢ map (↑f) μ = ENNReal.ofReal |(↑LinearMap.det f)⁻¹| • μ
[PROOFSTEP]
cases nonempty_fintype ι
[GOAL]
case intro
ι : Type u_1
inst✝¹ : Finite ι
f : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det f ≠ 0
μ : Measure (ι → ℝ)
inst✝ : IsAddHaarMeasure μ
val✝ : Fintype ι
⊢ map (↑f) μ = ENNReal.ofReal |(↑LinearMap.det f)⁻¹| • μ
[PROOFSTEP]
have := addHaarMeasure_unique μ (piIcc01 ι)
[GOAL]
case intro
ι : Type u_1
inst✝¹ : Finite ι
f : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det f ≠ 0
μ : Measure (ι → ℝ)
inst✝ : IsAddHaarMeasure μ
val✝ : Fintype ι
this : μ = ↑↑μ ↑(piIcc01 ι) • addHaarMeasure (piIcc01 ι)
⊢ map (↑f) μ = ENNReal.ofReal |(↑LinearMap.det f)⁻¹| • μ
[PROOFSTEP]
rw [this, addHaarMeasure_eq_volume_pi, Measure.map_smul, Real.map_linearMap_volume_pi_eq_smul_volume_pi hf, smul_comm]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
hf : ↑LinearMap.det f ≠ 0
⊢ map (↑f) μ = ENNReal.ofReal |(↑LinearMap.det f)⁻¹| • μ
[PROOFSTEP]
let ι := Fin (finrank ℝ E)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
hf : ↑LinearMap.det f ≠ 0
ι : Type := Fin (finrank ℝ E)
⊢ map (↑f) μ = ENNReal.ofReal |(↑LinearMap.det f)⁻¹| • μ
[PROOFSTEP]
haveI : FiniteDimensional ℝ (ι → ℝ) := by infer_instance
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
hf : ↑LinearMap.det f ≠ 0
ι : Type := Fin (finrank ℝ E)
⊢ FiniteDimensional ℝ (ι → ℝ)
[PROOFSTEP]
infer_instance
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
hf : ↑LinearMap.det f ≠ 0
ι : Type := Fin (finrank ℝ E)
this : FiniteDimensional ℝ (ι → ℝ)
⊢ map (↑f) μ = ENNReal.ofReal |(↑LinearMap.det f)⁻¹| • μ
[PROOFSTEP]
have : finrank ℝ E = finrank ℝ (ι → ℝ) := by simp
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
hf : ↑LinearMap.det f ≠ 0
ι : Type := Fin (finrank ℝ E)
this : FiniteDimensional ℝ (ι → ℝ)
⊢ finrank ℝ E = finrank ℝ (ι → ℝ)
[PROOFSTEP]
simp
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
hf : ↑LinearMap.det f ≠ 0
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
⊢ map (↑f) μ = ENNReal.ofReal |(↑LinearMap.det f)⁻¹| • μ
[PROOFSTEP]
have e : E ≃ₗ[ℝ] ι → ℝ := LinearEquiv.ofFinrankEq E (ι → ℝ) this
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
hf : ↑LinearMap.det f ≠ 0
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
⊢ map (↑f) μ = ENNReal.ofReal |(↑LinearMap.det f)⁻¹| • μ
[PROOFSTEP]
obtain ⟨g, hg⟩ : ∃ g, g = (e : E →ₗ[ℝ] ι → ℝ).comp (f.comp (e.symm : (ι → ℝ) →ₗ[ℝ] E)) := ⟨_, rfl⟩
[GOAL]
case intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
hf : ↑LinearMap.det f ≠ 0
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
⊢ map (↑f) μ = ENNReal.ofReal |(↑LinearMap.det f)⁻¹| • μ
[PROOFSTEP]
have gdet : LinearMap.det g = LinearMap.det f := by rw [hg]; exact LinearMap.det_conj f e
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
hf : ↑LinearMap.det f ≠ 0
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
⊢ ↑LinearMap.det g = ↑LinearMap.det f
[PROOFSTEP]
rw [hg]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
hf : ↑LinearMap.det f ≠ 0
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
⊢ ↑LinearMap.det (LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))) = ↑LinearMap.det f
[PROOFSTEP]
exact LinearMap.det_conj f e
[GOAL]
case intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
hf : ↑LinearMap.det f ≠ 0
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
gdet : ↑LinearMap.det g = ↑LinearMap.det f
⊢ map (↑f) μ = ENNReal.ofReal |(↑LinearMap.det f)⁻¹| • μ
[PROOFSTEP]
rw [← gdet] at hf ⊢
[GOAL]
case intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det g ≠ 0
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
gdet : ↑LinearMap.det g = ↑LinearMap.det f
⊢ map (↑f) μ = ENNReal.ofReal |(↑LinearMap.det g)⁻¹| • μ
[PROOFSTEP]
have fg : f = (e.symm : (ι → ℝ) →ₗ[ℝ] E).comp (g.comp (e : E →ₗ[ℝ] ι → ℝ)) :=
by
ext x
simp only [LinearEquiv.coe_coe, Function.comp_apply, LinearMap.coe_comp, LinearEquiv.symm_apply_apply, hg]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det g ≠ 0
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
gdet : ↑LinearMap.det g = ↑LinearMap.det f
⊢ f = LinearMap.comp (↑(LinearEquiv.symm e)) (LinearMap.comp g ↑e)
[PROOFSTEP]
ext x
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det g ≠ 0
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
gdet : ↑LinearMap.det g = ↑LinearMap.det f
x : E
⊢ ↑f x = ↑(LinearMap.comp (↑(LinearEquiv.symm e)) (LinearMap.comp g ↑e)) x
[PROOFSTEP]
simp only [LinearEquiv.coe_coe, Function.comp_apply, LinearMap.coe_comp, LinearEquiv.symm_apply_apply, hg]
[GOAL]
case intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det g ≠ 0
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
gdet : ↑LinearMap.det g = ↑LinearMap.det f
fg : f = LinearMap.comp (↑(LinearEquiv.symm e)) (LinearMap.comp g ↑e)
⊢ map (↑f) μ = ENNReal.ofReal |(↑LinearMap.det g)⁻¹| • μ
[PROOFSTEP]
simp only [fg, LinearEquiv.coe_coe, LinearMap.coe_comp]
[GOAL]
case intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det g ≠ 0
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
gdet : ↑LinearMap.det g = ↑LinearMap.det f
fg : f = LinearMap.comp (↑(LinearEquiv.symm e)) (LinearMap.comp g ↑e)
⊢ map (↑(LinearEquiv.symm e) ∘ ↑g ∘ ↑e) μ = ENNReal.ofReal |(↑LinearMap.det g)⁻¹| • μ
[PROOFSTEP]
have Ce : Continuous e := (e : E →ₗ[ℝ] ι → ℝ).continuous_of_finiteDimensional
[GOAL]
case intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det g ≠ 0
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
gdet : ↑LinearMap.det g = ↑LinearMap.det f
fg : f = LinearMap.comp (↑(LinearEquiv.symm e)) (LinearMap.comp g ↑e)
Ce : Continuous ↑e
⊢ map (↑(LinearEquiv.symm e) ∘ ↑g ∘ ↑e) μ = ENNReal.ofReal |(↑LinearMap.det g)⁻¹| • μ
[PROOFSTEP]
have Cg : Continuous g := LinearMap.continuous_of_finiteDimensional g
[GOAL]
case intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det g ≠ 0
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
gdet : ↑LinearMap.det g = ↑LinearMap.det f
fg : f = LinearMap.comp (↑(LinearEquiv.symm e)) (LinearMap.comp g ↑e)
Ce : Continuous ↑e
Cg : Continuous ↑g
⊢ map (↑(LinearEquiv.symm e) ∘ ↑g ∘ ↑e) μ = ENNReal.ofReal |(↑LinearMap.det g)⁻¹| • μ
[PROOFSTEP]
have Cesymm : Continuous e.symm := (e.symm : (ι → ℝ) →ₗ[ℝ] E).continuous_of_finiteDimensional
[GOAL]
case intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det g ≠ 0
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
gdet : ↑LinearMap.det g = ↑LinearMap.det f
fg : f = LinearMap.comp (↑(LinearEquiv.symm e)) (LinearMap.comp g ↑e)
Ce : Continuous ↑e
Cg : Continuous ↑g
Cesymm : Continuous ↑(LinearEquiv.symm e)
⊢ map (↑(LinearEquiv.symm e) ∘ ↑g ∘ ↑e) μ = ENNReal.ofReal |(↑LinearMap.det g)⁻¹| • μ
[PROOFSTEP]
rw [← map_map Cesymm.measurable (Cg.comp Ce).measurable, ← map_map Cg.measurable Ce.measurable]
[GOAL]
case intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
ι : Type := Fin (finrank ℝ E)
this✝ : FiniteDimensional ℝ (ι → ℝ)
this : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det g ≠ 0
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
gdet : ↑LinearMap.det g = ↑LinearMap.det f
fg : f = LinearMap.comp (↑(LinearEquiv.symm e)) (LinearMap.comp g ↑e)
Ce : Continuous ↑e
Cg : Continuous ↑g
Cesymm : Continuous ↑(LinearEquiv.symm e)
⊢ map (↑(LinearEquiv.symm e)) (map (↑g) (map (↑e) μ)) = ENNReal.ofReal |(↑LinearMap.det g)⁻¹| • μ
[PROOFSTEP]
haveI : IsAddHaarMeasure (map e μ) := (e : E ≃+ (ι → ℝ)).isAddHaarMeasure_map μ Ce Cesymm
[GOAL]
case intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
ι : Type := Fin (finrank ℝ E)
this✝¹ : FiniteDimensional ℝ (ι → ℝ)
this✝ : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det g ≠ 0
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
gdet : ↑LinearMap.det g = ↑LinearMap.det f
fg : f = LinearMap.comp (↑(LinearEquiv.symm e)) (LinearMap.comp g ↑e)
Ce : Continuous ↑e
Cg : Continuous ↑g
Cesymm : Continuous ↑(LinearEquiv.symm e)
this : IsAddHaarMeasure (map (↑e) μ)
⊢ map (↑(LinearEquiv.symm e)) (map (↑g) (map (↑e) μ)) = ENNReal.ofReal |(↑LinearMap.det g)⁻¹| • μ
[PROOFSTEP]
have ecomp : e.symm ∘ e = id := by ext x; simp only [id.def, Function.comp_apply, LinearEquiv.symm_apply_apply]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
ι : Type := Fin (finrank ℝ E)
this✝¹ : FiniteDimensional ℝ (ι → ℝ)
this✝ : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det g ≠ 0
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
gdet : ↑LinearMap.det g = ↑LinearMap.det f
fg : f = LinearMap.comp (↑(LinearEquiv.symm e)) (LinearMap.comp g ↑e)
Ce : Continuous ↑e
Cg : Continuous ↑g
Cesymm : Continuous ↑(LinearEquiv.symm e)
this : IsAddHaarMeasure (map (↑e) μ)
⊢ ↑(LinearEquiv.symm e) ∘ ↑e = id
[PROOFSTEP]
ext x
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
ι : Type := Fin (finrank ℝ E)
this✝¹ : FiniteDimensional ℝ (ι → ℝ)
this✝ : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det g ≠ 0
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
gdet : ↑LinearMap.det g = ↑LinearMap.det f
fg : f = LinearMap.comp (↑(LinearEquiv.symm e)) (LinearMap.comp g ↑e)
Ce : Continuous ↑e
Cg : Continuous ↑g
Cesymm : Continuous ↑(LinearEquiv.symm e)
this : IsAddHaarMeasure (map (↑e) μ)
x : E
⊢ (↑(LinearEquiv.symm e) ∘ ↑e) x = id x
[PROOFSTEP]
simp only [id.def, Function.comp_apply, LinearEquiv.symm_apply_apply]
[GOAL]
case intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
ι : Type := Fin (finrank ℝ E)
this✝¹ : FiniteDimensional ℝ (ι → ℝ)
this✝ : finrank ℝ E = finrank ℝ (ι → ℝ)
e : E ≃ₗ[ℝ] ι → ℝ
g : (ι → ℝ) →ₗ[ℝ] ι → ℝ
hf : ↑LinearMap.det g ≠ 0
hg : g = LinearMap.comp (↑e) (LinearMap.comp f ↑(LinearEquiv.symm e))
gdet : ↑LinearMap.det g = ↑LinearMap.det f
fg : f = LinearMap.comp (↑(LinearEquiv.symm e)) (LinearMap.comp g ↑e)
Ce : Continuous ↑e
Cg : Continuous ↑g
Cesymm : Continuous ↑(LinearEquiv.symm e)
this : IsAddHaarMeasure (map (↑e) μ)
ecomp : ↑(LinearEquiv.symm e) ∘ ↑e = id
⊢ map (↑(LinearEquiv.symm e)) (map (↑g) (map (↑e) μ)) = ENNReal.ofReal |(↑LinearMap.det g)⁻¹| • μ
[PROOFSTEP]
rw [map_linearMap_addHaar_pi_eq_smul_addHaar hf (map e μ), Measure.map_smul, map_map Cesymm.measurable Ce.measurable,
ecomp, Measure.map_id]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
hf : ↑LinearMap.det f ≠ 0
s : Set E
⊢ ↑↑(map (↑f) μ) s = ENNReal.ofReal |(↑LinearMap.det f)⁻¹| * ↑↑μ s
[PROOFSTEP]
rw [map_linearMap_addHaar_eq_smul_addHaar μ hf]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
hf : ↑LinearMap.det f ≠ 0
s : Set E
⊢ ↑↑(ENNReal.ofReal |(↑LinearMap.det f)⁻¹| • μ) s = ENNReal.ofReal |(↑LinearMap.det f)⁻¹| * ↑↑μ s
[PROOFSTEP]
rfl
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E ≃ₗ[ℝ] E
s : Set E
⊢ ↑↑μ (↑f ⁻¹' s) = ENNReal.ofReal |↑LinearMap.det ↑(LinearEquiv.symm f)| * ↑↑μ s
[PROOFSTEP]
have A : LinearMap.det (f : E →ₗ[ℝ] E) ≠ 0 := (LinearEquiv.isUnit_det' f).ne_zero
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E ≃ₗ[ℝ] E
s : Set E
A : ↑LinearMap.det ↑f ≠ 0
⊢ ↑↑μ (↑f ⁻¹' s) = ENNReal.ofReal |↑LinearMap.det ↑(LinearEquiv.symm f)| * ↑↑μ s
[PROOFSTEP]
convert addHaar_preimage_linearMap μ A s
[GOAL]
case h.e'_3.h.e'_5.h.e'_1.h.e'_3
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E ≃ₗ[ℝ] E
s : Set E
A : ↑LinearMap.det ↑f ≠ 0
⊢ ↑LinearMap.det ↑(LinearEquiv.symm f) = (↑LinearMap.det ↑f)⁻¹
[PROOFSTEP]
simp only [LinearEquiv.det_coe_symm]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
s : Set E
⊢ ↑↑μ (↑f '' s) = ENNReal.ofReal |↑LinearMap.det f| * ↑↑μ s
[PROOFSTEP]
rcases ne_or_eq (LinearMap.det f) 0 with (hf | hf)
[GOAL]
case inl
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
s : Set E
hf : ↑LinearMap.det f ≠ 0
⊢ ↑↑μ (↑f '' s) = ENNReal.ofReal |↑LinearMap.det f| * ↑↑μ s
[PROOFSTEP]
let g := (f.equivOfDetNeZero hf).toContinuousLinearEquiv
[GOAL]
case inl
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
s : Set E
hf : ↑LinearMap.det f ≠ 0
g : E ≃L[ℝ] E := LinearEquiv.toContinuousLinearEquiv (LinearMap.equivOfDetNeZero f hf)
⊢ ↑↑μ (↑f '' s) = ENNReal.ofReal |↑LinearMap.det f| * ↑↑μ s
[PROOFSTEP]
change μ (g '' s) = _
[GOAL]
case inl
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
s : Set E
hf : ↑LinearMap.det f ≠ 0
g : E ≃L[ℝ] E := LinearEquiv.toContinuousLinearEquiv (LinearMap.equivOfDetNeZero f hf)
⊢ ↑↑μ (↑g '' s) = ENNReal.ofReal |↑LinearMap.det f| * ↑↑μ s
[PROOFSTEP]
rw [ContinuousLinearEquiv.image_eq_preimage g s, addHaar_preimage_continuousLinearEquiv]
[GOAL]
case inl
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
s : Set E
hf : ↑LinearMap.det f ≠ 0
g : E ≃L[ℝ] E := LinearEquiv.toContinuousLinearEquiv (LinearMap.equivOfDetNeZero f hf)
⊢ ENNReal.ofReal |↑LinearMap.det ↑↑(ContinuousLinearEquiv.symm (ContinuousLinearEquiv.symm g))| * ↑↑μ s =
ENNReal.ofReal |↑LinearMap.det f| * ↑↑μ s
[PROOFSTEP]
congr
[GOAL]
case inr
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
s : Set E
hf : ↑LinearMap.det f = 0
⊢ ↑↑μ (↑f '' s) = ENNReal.ofReal |↑LinearMap.det f| * ↑↑μ s
[PROOFSTEP]
simp only [hf, zero_mul, ENNReal.ofReal_zero, abs_zero]
[GOAL]
case inr
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
s : Set E
hf : ↑LinearMap.det f = 0
⊢ ↑↑μ ((fun a => ↑f a) '' s) = 0
[PROOFSTEP]
have : μ (LinearMap.range f) = 0 := addHaar_submodule μ _ (LinearMap.range_lt_top_of_det_eq_zero hf).ne
[GOAL]
case inr
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
f : E →ₗ[ℝ] E
s : Set E
hf : ↑LinearMap.det f = 0
this : ↑↑μ ↑(LinearMap.range f) = 0
⊢ ↑↑μ ((fun a => ↑f a) '' s) = 0
[PROOFSTEP]
exact le_antisymm (le_trans (measure_mono (image_subset_range _ _)) this.le) (zero_le _)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
r : ℝ
hr : r ≠ 0
⊢ map ((fun x x_1 => x • x_1) r) μ = ENNReal.ofReal |(r ^ finrank ℝ E)⁻¹| • μ
[PROOFSTEP]
let f : E →ₗ[ℝ] E := r • (1 : E →ₗ[ℝ] E)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
r : ℝ
hr : r ≠ 0
f : E →ₗ[ℝ] E := r • 1
⊢ map ((fun x x_1 => x • x_1) r) μ = ENNReal.ofReal |(r ^ finrank ℝ E)⁻¹| • μ
[PROOFSTEP]
change Measure.map f μ = _
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
r : ℝ
hr : r ≠ 0
f : E →ₗ[ℝ] E := r • 1
⊢ map (↑f) μ = ENNReal.ofReal |(r ^ finrank ℝ E)⁻¹| • μ
[PROOFSTEP]
have hf : LinearMap.det f ≠ 0 :=
by
simp only [mul_one, LinearMap.det_smul, Ne.def, MonoidHom.map_one]
intro h
exact hr (pow_eq_zero h)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
r : ℝ
hr : r ≠ 0
f : E →ₗ[ℝ] E := r • 1
⊢ ↑LinearMap.det f ≠ 0
[PROOFSTEP]
simp only [mul_one, LinearMap.det_smul, Ne.def, MonoidHom.map_one]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
r : ℝ
hr : r ≠ 0
f : E →ₗ[ℝ] E := r • 1
⊢ ¬r ^ finrank ℝ E = 0
[PROOFSTEP]
intro h
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
r : ℝ
hr : r ≠ 0
f : E →ₗ[ℝ] E := r • 1
h : r ^ finrank ℝ E = 0
⊢ False
[PROOFSTEP]
exact hr (pow_eq_zero h)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
r : ℝ
hr : r ≠ 0
f : E →ₗ[ℝ] E := r • 1
hf : ↑LinearMap.det f ≠ 0
⊢ map (↑f) μ = ENNReal.ofReal |(r ^ finrank ℝ E)⁻¹| • μ
[PROOFSTEP]
simp only [map_linearMap_addHaar_eq_smul_addHaar μ hf, mul_one, LinearMap.det_smul, map_one]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
r : ℝ
hr : r ≠ 0
s : Set E
⊢ ↑↑(map ((fun x x_1 => x • x_1) r) μ) s = ENNReal.ofReal |(r ^ finrank ℝ E)⁻¹| * ↑↑μ s
[PROOFSTEP]
rw [map_addHaar_smul μ hr, smul_toOuterMeasure, OuterMeasure.coe_smul, Pi.smul_apply, smul_eq_mul]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
r : ℝ
s : Set E
⊢ ↑↑μ (r • s) = ENNReal.ofReal |r ^ finrank ℝ E| * ↑↑μ s
[PROOFSTEP]
rcases ne_or_eq r 0 with (h | rfl)
[GOAL]
case inl
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
r : ℝ
s : Set E
h : r ≠ 0
⊢ ↑↑μ (r • s) = ENNReal.ofReal |r ^ finrank ℝ E| * ↑↑μ s
[PROOFSTEP]
rw [← preimage_smul_inv₀ h, addHaar_preimage_smul μ (inv_ne_zero h), inv_pow, inv_inv]
[GOAL]
case inr
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
⊢ ↑↑μ (0 • s) = ENNReal.ofReal |0 ^ finrank ℝ E| * ↑↑μ s
[PROOFSTEP]
rcases eq_empty_or_nonempty s with (rfl | hs)
[GOAL]
case inr.inl
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
⊢ ↑↑μ (0 • ∅) = ENNReal.ofReal |0 ^ finrank ℝ E| * ↑↑μ ∅
[PROOFSTEP]
simp only [measure_empty, mul_zero, smul_set_empty]
[GOAL]
case inr.inr
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
hs : Set.Nonempty s
⊢ ↑↑μ (0 • s) = ENNReal.ofReal |0 ^ finrank ℝ E| * ↑↑μ s
[PROOFSTEP]
rw [zero_smul_set hs, ← singleton_zero]
[GOAL]
case inr.inr
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
hs : Set.Nonempty s
⊢ ↑↑μ {0} = ENNReal.ofReal |0 ^ finrank ℝ E| * ↑↑μ s
[PROOFSTEP]
by_cases h : finrank ℝ E = 0
[GOAL]
case pos
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
hs : Set.Nonempty s
h : finrank ℝ E = 0
⊢ ↑↑μ {0} = ENNReal.ofReal |0 ^ finrank ℝ E| * ↑↑μ s
[PROOFSTEP]
haveI : Subsingleton E := finrank_zero_iff.1 h
[GOAL]
case pos
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
hs : Set.Nonempty s
h : finrank ℝ E = 0
this : Subsingleton E
⊢ ↑↑μ {0} = ENNReal.ofReal |0 ^ finrank ℝ E| * ↑↑μ s
[PROOFSTEP]
simp only [h, one_mul, ENNReal.ofReal_one, abs_one, Subsingleton.eq_univ_of_nonempty hs, pow_zero,
Subsingleton.eq_univ_of_nonempty (singleton_nonempty (0 : E))]
[GOAL]
case neg
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
hs : Set.Nonempty s
h : ¬finrank ℝ E = 0
⊢ ↑↑μ {0} = ENNReal.ofReal |0 ^ finrank ℝ E| * ↑↑μ s
[PROOFSTEP]
haveI : Nontrivial E := nontrivial_of_finrank_pos (bot_lt_iff_ne_bot.2 h)
[GOAL]
case neg
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
hs : Set.Nonempty s
h : ¬finrank ℝ E = 0
this : Nontrivial E
⊢ ↑↑μ {0} = ENNReal.ofReal |0 ^ finrank ℝ E| * ↑↑μ s
[PROOFSTEP]
simp only [h, zero_mul, ENNReal.ofReal_zero, abs_zero, Ne.def, not_false_iff, zero_pow', measure_singleton]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
r : ℝ
hr : 0 ≤ r
s : Set E
⊢ ↑↑μ (r • s) = ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ s
[PROOFSTEP]
rw [addHaar_smul, abs_pow, abs_of_nonneg hr]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
hs : NullMeasurableSet s
r : ℝ
⊢ NullMeasurableSet (r • s)
[PROOFSTEP]
obtain rfl | hs' := s.eq_empty_or_nonempty
[GOAL]
case inl
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
r : ℝ
hs : NullMeasurableSet ∅
⊢ NullMeasurableSet (r • ∅)
[PROOFSTEP]
simp
[GOAL]
case inr
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
hs : NullMeasurableSet s
r : ℝ
hs' : Set.Nonempty s
⊢ NullMeasurableSet (r • s)
[PROOFSTEP]
obtain rfl | hr := eq_or_ne r 0
[GOAL]
case inr.inl
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
hs : NullMeasurableSet s
hs' : Set.Nonempty s
⊢ NullMeasurableSet (0 • s)
[PROOFSTEP]
simpa [zero_smul_set hs'] using nullMeasurableSet_singleton _
[GOAL]
case inr.inr
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
hs : NullMeasurableSet s
r : ℝ
hs' : Set.Nonempty s
hr : r ≠ 0
⊢ NullMeasurableSet (r • s)
[PROOFSTEP]
obtain ⟨t, ht, hst⟩ := hs
[GOAL]
case inr.inr.intro.intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
r : ℝ
hs' : Set.Nonempty s
hr : r ≠ 0
t : Set E
ht : MeasurableSet t
hst : s =ᶠ[ae μ] t
⊢ NullMeasurableSet (r • s)
[PROOFSTEP]
refine' ⟨_, ht.const_smul_of_ne_zero hr, _⟩
[GOAL]
case inr.inr.intro.intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
r : ℝ
hs' : Set.Nonempty s
hr : r ≠ 0
t : Set E
ht : MeasurableSet t
hst : s =ᶠ[ae μ] t
⊢ r • s =ᶠ[ae μ] r • t
[PROOFSTEP]
rw [← measure_symmDiff_eq_zero_iff] at hst ⊢
[GOAL]
case inr.inr.intro.intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
r : ℝ
hs' : Set.Nonempty s
hr : r ≠ 0
t : Set E
ht : MeasurableSet t
hst : ↑↑μ (s ∆ t) = 0
⊢ ↑↑μ ((r • s) ∆ (r • t)) = 0
[PROOFSTEP]
rw [← smul_set_symmDiff₀ hr, addHaar_smul μ, hst, mul_zero]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
x : E
r : ℝ
s : Set E
⊢ ↑↑μ (↑(AffineMap.homothety x r) '' s) = ↑↑μ ((fun y => y + x) '' (r • (fun y => y + -x) '' s))
[PROOFSTEP]
simp only [← image_smul, image_image, ← sub_eq_add_neg]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
x : E
r : ℝ
s : Set E
⊢ ↑↑μ ((fun a => ↑(AffineMap.homothety x r) a) '' s) = ↑↑μ ((fun x_1 => r • (x_1 - x) + x) '' s)
[PROOFSTEP]
rfl
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
x : E
r : ℝ
s : Set E
⊢ ↑↑μ ((fun y => y + x) '' (r • (fun y => y + -x) '' s)) = ENNReal.ofReal |r ^ finrank ℝ E| * ↑↑μ s
[PROOFSTEP]
simp only [image_add_right, measure_preimage_add_right, addHaar_smul]
[GOAL]
E✝ : Type u_1
inst✝¹² : NormedAddCommGroup E✝
inst✝¹¹ : NormedSpace ℝ E✝
inst✝¹⁰ : MeasurableSpace E✝
inst✝⁹ : BorelSpace E✝
inst✝⁸ : FiniteDimensional ℝ E✝
μ✝ : Measure E✝
inst✝⁷ : IsAddHaarMeasure μ✝
F : Type u_2
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedSpace ℝ F
inst✝⁴ : CompleteSpace F
s : Set E✝
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
x : E
r : ℝ
⊢ ↑↑μ (ball x r) = ↑↑μ (ball 0 r)
[PROOFSTEP]
have : ball (0 : E) r = (· + ·) x ⁻¹' ball x r := by simp [preimage_add_ball]
[GOAL]
E✝ : Type u_1
inst✝¹² : NormedAddCommGroup E✝
inst✝¹¹ : NormedSpace ℝ E✝
inst✝¹⁰ : MeasurableSpace E✝
inst✝⁹ : BorelSpace E✝
inst✝⁸ : FiniteDimensional ℝ E✝
μ✝ : Measure E✝
inst✝⁷ : IsAddHaarMeasure μ✝
F : Type u_2
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedSpace ℝ F
inst✝⁴ : CompleteSpace F
s : Set E✝
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
x : E
r : ℝ
⊢ ball 0 r = (fun x x_1 => x + x_1) x ⁻¹' ball x r
[PROOFSTEP]
simp [preimage_add_ball]
[GOAL]
E✝ : Type u_1
inst✝¹² : NormedAddCommGroup E✝
inst✝¹¹ : NormedSpace ℝ E✝
inst✝¹⁰ : MeasurableSpace E✝
inst✝⁹ : BorelSpace E✝
inst✝⁸ : FiniteDimensional ℝ E✝
μ✝ : Measure E✝
inst✝⁷ : IsAddHaarMeasure μ✝
F : Type u_2
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedSpace ℝ F
inst✝⁴ : CompleteSpace F
s : Set E✝
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
x : E
r : ℝ
this : ball 0 r = (fun x x_1 => x + x_1) x ⁻¹' ball x r
⊢ ↑↑μ (ball x r) = ↑↑μ (ball 0 r)
[PROOFSTEP]
rw [this, measure_preimage_add]
[GOAL]
E✝ : Type u_1
inst✝¹² : NormedAddCommGroup E✝
inst✝¹¹ : NormedSpace ℝ E✝
inst✝¹⁰ : MeasurableSpace E✝
inst✝⁹ : BorelSpace E✝
inst✝⁸ : FiniteDimensional ℝ E✝
μ✝ : Measure E✝
inst✝⁷ : IsAddHaarMeasure μ✝
F : Type u_2
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedSpace ℝ F
inst✝⁴ : CompleteSpace F
s : Set E✝
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
x : E
r : ℝ
⊢ ↑↑μ (closedBall x r) = ↑↑μ (closedBall 0 r)
[PROOFSTEP]
have : closedBall (0 : E) r = (· + ·) x ⁻¹' closedBall x r := by simp [preimage_add_closedBall]
[GOAL]
E✝ : Type u_1
inst✝¹² : NormedAddCommGroup E✝
inst✝¹¹ : NormedSpace ℝ E✝
inst✝¹⁰ : MeasurableSpace E✝
inst✝⁹ : BorelSpace E✝
inst✝⁸ : FiniteDimensional ℝ E✝
μ✝ : Measure E✝
inst✝⁷ : IsAddHaarMeasure μ✝
F : Type u_2
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedSpace ℝ F
inst✝⁴ : CompleteSpace F
s : Set E✝
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
x : E
r : ℝ
⊢ closedBall 0 r = (fun x x_1 => x + x_1) x ⁻¹' closedBall x r
[PROOFSTEP]
simp [preimage_add_closedBall]
[GOAL]
E✝ : Type u_1
inst✝¹² : NormedAddCommGroup E✝
inst✝¹¹ : NormedSpace ℝ E✝
inst✝¹⁰ : MeasurableSpace E✝
inst✝⁹ : BorelSpace E✝
inst✝⁸ : FiniteDimensional ℝ E✝
μ✝ : Measure E✝
inst✝⁷ : IsAddHaarMeasure μ✝
F : Type u_2
inst✝⁶ : NormedAddCommGroup F
inst✝⁵ : NormedSpace ℝ F
inst✝⁴ : CompleteSpace F
s : Set E✝
E : Type u_3
inst✝³ : NormedAddCommGroup E
inst✝² : MeasurableSpace E
inst✝¹ : BorelSpace E
μ : Measure E
inst✝ : IsAddHaarMeasure μ
x : E
r : ℝ
this : closedBall 0 r = (fun x x_1 => x + x_1) x ⁻¹' closedBall x r
⊢ ↑↑μ (closedBall x r) = ↑↑μ (closedBall 0 r)
[PROOFSTEP]
rw [this, measure_preimage_add]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
x : E
r : ℝ
hr : 0 < r
s : ℝ
⊢ ↑↑μ (ball x (r * s)) = ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (ball 0 s)
[PROOFSTEP]
have : ball (0 : E) (r * s) = r • ball (0 : E) s := by
simp only [_root_.smul_ball hr.ne' (0 : E) s, Real.norm_eq_abs, abs_of_nonneg hr.le, smul_zero]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
x : E
r : ℝ
hr : 0 < r
s : ℝ
⊢ ball 0 (r * s) = r • ball 0 s
[PROOFSTEP]
simp only [_root_.smul_ball hr.ne' (0 : E) s, Real.norm_eq_abs, abs_of_nonneg hr.le, smul_zero]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
x : E
r : ℝ
hr : 0 < r
s : ℝ
this : ball 0 (r * s) = r • ball 0 s
⊢ ↑↑μ (ball x (r * s)) = ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (ball 0 s)
[PROOFSTEP]
simp only [this, addHaar_smul, abs_of_nonneg hr.le, addHaar_ball_center, abs_pow]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
x : E
r : ℝ
hr : 0 < r
⊢ ↑↑μ (ball x r) = ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (ball 0 1)
[PROOFSTEP]
rw [← addHaar_ball_mul_of_pos μ x hr, mul_one]
[GOAL]
E : Type u_1
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace ℝ E
inst✝⁷ : MeasurableSpace E
inst✝⁶ : BorelSpace E
inst✝⁵ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁴ : IsAddHaarMeasure μ
F : Type u_2
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
s✝ : Set E
inst✝ : Nontrivial E
x : E
r : ℝ
hr : 0 ≤ r
s : ℝ
⊢ ↑↑μ (ball x (r * s)) = ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (ball 0 s)
[PROOFSTEP]
rcases hr.eq_or_lt with (rfl | h)
[GOAL]
case inl
E : Type u_1
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace ℝ E
inst✝⁷ : MeasurableSpace E
inst✝⁶ : BorelSpace E
inst✝⁵ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁴ : IsAddHaarMeasure μ
F : Type u_2
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
s✝ : Set E
inst✝ : Nontrivial E
x : E
s : ℝ
hr : 0 ≤ 0
⊢ ↑↑μ (ball x (0 * s)) = ENNReal.ofReal (0 ^ finrank ℝ E) * ↑↑μ (ball 0 s)
[PROOFSTEP]
simp only [zero_pow (finrank_pos (K := ℝ) (V := E)), measure_empty, zero_mul, ENNReal.ofReal_zero, ball_zero]
[GOAL]
case inr
E : Type u_1
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace ℝ E
inst✝⁷ : MeasurableSpace E
inst✝⁶ : BorelSpace E
inst✝⁵ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁴ : IsAddHaarMeasure μ
F : Type u_2
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
s✝ : Set E
inst✝ : Nontrivial E
x : E
r : ℝ
hr : 0 ≤ r
s : ℝ
h : 0 < r
⊢ ↑↑μ (ball x (r * s)) = ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (ball 0 s)
[PROOFSTEP]
exact addHaar_ball_mul_of_pos μ x h s
[GOAL]
E : Type u_1
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace ℝ E
inst✝⁷ : MeasurableSpace E
inst✝⁶ : BorelSpace E
inst✝⁵ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁴ : IsAddHaarMeasure μ
F : Type u_2
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
s : Set E
inst✝ : Nontrivial E
x : E
r : ℝ
hr : 0 ≤ r
⊢ ↑↑μ (ball x r) = ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (ball 0 1)
[PROOFSTEP]
rw [← addHaar_ball_mul μ x hr, mul_one]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
x : E
r : ℝ
hr : 0 < r
s : ℝ
⊢ ↑↑μ (closedBall x (r * s)) = ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (closedBall 0 s)
[PROOFSTEP]
have : closedBall (0 : E) (r * s) = r • closedBall (0 : E) s := by
simp [smul_closedBall' hr.ne' (0 : E), abs_of_nonneg hr.le]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
x : E
r : ℝ
hr : 0 < r
s : ℝ
⊢ closedBall 0 (r * s) = r • closedBall 0 s
[PROOFSTEP]
simp [smul_closedBall' hr.ne' (0 : E), abs_of_nonneg hr.le]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
x : E
r : ℝ
hr : 0 < r
s : ℝ
this : closedBall 0 (r * s) = r • closedBall 0 s
⊢ ↑↑μ (closedBall x (r * s)) = ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (closedBall 0 s)
[PROOFSTEP]
simp only [this, addHaar_smul, abs_of_nonneg hr.le, addHaar_closedBall_center, abs_pow]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
x : E
r : ℝ
hr : 0 ≤ r
s : ℝ
hs : 0 ≤ s
⊢ ↑↑μ (closedBall x (r * s)) = ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (closedBall 0 s)
[PROOFSTEP]
have : closedBall (0 : E) (r * s) = r • closedBall (0 : E) s := by simp [smul_closedBall r (0 : E) hs, abs_of_nonneg hr]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
x : E
r : ℝ
hr : 0 ≤ r
s : ℝ
hs : 0 ≤ s
⊢ closedBall 0 (r * s) = r • closedBall 0 s
[PROOFSTEP]
simp [smul_closedBall r (0 : E) hs, abs_of_nonneg hr]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
x : E
r : ℝ
hr : 0 ≤ r
s : ℝ
hs : 0 ≤ s
this : closedBall 0 (r * s) = r • closedBall 0 s
⊢ ↑↑μ (closedBall x (r * s)) = ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (closedBall 0 s)
[PROOFSTEP]
simp only [this, addHaar_smul, abs_of_nonneg hr, addHaar_closedBall_center, abs_pow]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
x : E
r : ℝ
hr : 0 ≤ r
⊢ ↑↑μ (closedBall x r) = ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (closedBall 0 1)
[PROOFSTEP]
rw [← addHaar_closedBall_mul μ x hr zero_le_one, mul_one]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
⊢ ↑↑μ (closedBall 0 1) = ↑↑μ (ball 0 1)
[PROOFSTEP]
apply le_antisymm _ (measure_mono ball_subset_closedBall)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
⊢ ↑↑μ (closedBall 0 1) ≤ ↑↑μ (ball 0 1)
[PROOFSTEP]
have A :
Tendsto (fun r : ℝ => ENNReal.ofReal (r ^ finrank ℝ E) * μ (closedBall (0 : E) 1)) (𝓝[<] 1)
(𝓝 (ENNReal.ofReal ((1 : ℝ) ^ finrank ℝ E) * μ (closedBall (0 : E) 1))) :=
by
refine' ENNReal.Tendsto.mul _ (by simp) tendsto_const_nhds (by simp)
exact ENNReal.tendsto_ofReal ((tendsto_id'.2 nhdsWithin_le_nhds).pow _)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
⊢ Tendsto (fun r => ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (closedBall 0 1)) (𝓝[Iio 1] 1)
(𝓝 (ENNReal.ofReal (1 ^ finrank ℝ E) * ↑↑μ (closedBall 0 1)))
[PROOFSTEP]
refine' ENNReal.Tendsto.mul _ (by simp) tendsto_const_nhds (by simp)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
⊢ ENNReal.ofReal (1 ^ finrank ℝ E) ≠ 0 ∨ ↑↑μ (closedBall 0 1) ≠ ⊤
[PROOFSTEP]
simp
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
⊢ ↑↑μ (closedBall 0 1) ≠ 0 ∨ ENNReal.ofReal (1 ^ finrank ℝ E) ≠ ⊤
[PROOFSTEP]
simp
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
⊢ Tendsto (fun r => ENNReal.ofReal (r ^ finrank ℝ E)) (𝓝[Iio 1] 1) (𝓝 (ENNReal.ofReal (1 ^ finrank ℝ E)))
[PROOFSTEP]
exact ENNReal.tendsto_ofReal ((tendsto_id'.2 nhdsWithin_le_nhds).pow _)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
A :
Tendsto (fun r => ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (closedBall 0 1)) (𝓝[Iio 1] 1)
(𝓝 (ENNReal.ofReal (1 ^ finrank ℝ E) * ↑↑μ (closedBall 0 1)))
⊢ ↑↑μ (closedBall 0 1) ≤ ↑↑μ (ball 0 1)
[PROOFSTEP]
simp only [one_pow, one_mul, ENNReal.ofReal_one] at A
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
A : Tendsto (fun r => ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (closedBall 0 1)) (𝓝[Iio 1] 1) (𝓝 (↑↑μ (closedBall 0 1)))
⊢ ↑↑μ (closedBall 0 1) ≤ ↑↑μ (ball 0 1)
[PROOFSTEP]
refine' le_of_tendsto A _
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
A : Tendsto (fun r => ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (closedBall 0 1)) (𝓝[Iio 1] 1) (𝓝 (↑↑μ (closedBall 0 1)))
⊢ ∀ᶠ (c : ℝ) in 𝓝[Iio 1] 1, ENNReal.ofReal (c ^ finrank ℝ E) * ↑↑μ (closedBall 0 1) ≤ ↑↑μ (ball 0 1)
[PROOFSTEP]
refine' mem_nhdsWithin_Iio_iff_exists_Ioo_subset.2 ⟨(0 : ℝ), by simp, fun r hr => _⟩
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
A : Tendsto (fun r => ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (closedBall 0 1)) (𝓝[Iio 1] 1) (𝓝 (↑↑μ (closedBall 0 1)))
⊢ 0 ∈ Iio 1
[PROOFSTEP]
simp
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
A : Tendsto (fun r => ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (closedBall 0 1)) (𝓝[Iio 1] 1) (𝓝 (↑↑μ (closedBall 0 1)))
r : ℝ
hr : r ∈ Ioo 0 1
⊢ r ∈ {x | (fun c => ENNReal.ofReal (c ^ finrank ℝ E) * ↑↑μ (closedBall 0 1) ≤ ↑↑μ (ball 0 1)) x}
[PROOFSTEP]
dsimp
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
A : Tendsto (fun r => ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (closedBall 0 1)) (𝓝[Iio 1] 1) (𝓝 (↑↑μ (closedBall 0 1)))
r : ℝ
hr : r ∈ Ioo 0 1
⊢ ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (closedBall 0 1) ≤ ↑↑μ (ball 0 1)
[PROOFSTEP]
rw [← addHaar_closedBall' μ (0 : E) hr.1.le]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
A : Tendsto (fun r => ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (closedBall 0 1)) (𝓝[Iio 1] 1) (𝓝 (↑↑μ (closedBall 0 1)))
r : ℝ
hr : r ∈ Ioo 0 1
⊢ ↑↑μ (closedBall 0 r) ≤ ↑↑μ (ball 0 1)
[PROOFSTEP]
exact measure_mono (closedBall_subset_ball hr.2)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
x : E
r : ℝ
hr : 0 ≤ r
⊢ ↑↑μ (closedBall x r) = ENNReal.ofReal (r ^ finrank ℝ E) * ↑↑μ (ball 0 1)
[PROOFSTEP]
rw [addHaar_closedBall' μ x hr, addHaar_closed_unit_ball_eq_addHaar_unit_ball]
[GOAL]
E : Type u_1
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace ℝ E
inst✝⁷ : MeasurableSpace E
inst✝⁶ : BorelSpace E
inst✝⁵ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁴ : IsAddHaarMeasure μ
F : Type u_2
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
s : Set E
inst✝ : Nontrivial E
x : E
r : ℝ
⊢ ↑↑μ (closedBall x r) = ↑↑μ (ball x r)
[PROOFSTEP]
by_cases h : r < 0
[GOAL]
case pos
E : Type u_1
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace ℝ E
inst✝⁷ : MeasurableSpace E
inst✝⁶ : BorelSpace E
inst✝⁵ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁴ : IsAddHaarMeasure μ
F : Type u_2
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
s : Set E
inst✝ : Nontrivial E
x : E
r : ℝ
h : r < 0
⊢ ↑↑μ (closedBall x r) = ↑↑μ (ball x r)
[PROOFSTEP]
rw [Metric.closedBall_eq_empty.mpr h, Metric.ball_eq_empty.mpr h.le]
[GOAL]
case neg
E : Type u_1
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace ℝ E
inst✝⁷ : MeasurableSpace E
inst✝⁶ : BorelSpace E
inst✝⁵ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁴ : IsAddHaarMeasure μ
F : Type u_2
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
s : Set E
inst✝ : Nontrivial E
x : E
r : ℝ
h : ¬r < 0
⊢ ↑↑μ (closedBall x r) = ↑↑μ (ball x r)
[PROOFSTEP]
push_neg at h
[GOAL]
case neg
E : Type u_1
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace ℝ E
inst✝⁷ : MeasurableSpace E
inst✝⁶ : BorelSpace E
inst✝⁵ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁴ : IsAddHaarMeasure μ
F : Type u_2
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
s : Set E
inst✝ : Nontrivial E
x : E
r : ℝ
h : 0 ≤ r
⊢ ↑↑μ (closedBall x r) = ↑↑μ (ball x r)
[PROOFSTEP]
rw [addHaar_closedBall μ x h, addHaar_ball μ x h]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
x : E
r : ℝ
hr : r ≠ 0
⊢ ↑↑μ (sphere x r) = 0
[PROOFSTEP]
rcases hr.lt_or_lt with (h | h)
[GOAL]
case inl
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
x : E
r : ℝ
hr : r ≠ 0
h : r < 0
⊢ ↑↑μ (sphere x r) = 0
[PROOFSTEP]
simp only [empty_diff, measure_empty, ← closedBall_diff_ball, closedBall_eq_empty.2 h]
[GOAL]
case inr
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
x : E
r : ℝ
hr : r ≠ 0
h : 0 < r
⊢ ↑↑μ (sphere x r) = 0
[PROOFSTEP]
rw [← closedBall_diff_ball, measure_diff ball_subset_closedBall measurableSet_ball measure_ball_lt_top.ne,
addHaar_ball_of_pos μ _ h, addHaar_closedBall μ _ h.le, tsub_self]
[GOAL]
E : Type u_1
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace ℝ E
inst✝⁷ : MeasurableSpace E
inst✝⁶ : BorelSpace E
inst✝⁵ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁴ : IsAddHaarMeasure μ
F : Type u_2
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
s : Set E
inst✝ : Nontrivial E
x : E
r : ℝ
⊢ ↑↑μ (sphere x r) = 0
[PROOFSTEP]
rcases eq_or_ne r 0 with (rfl | h)
[GOAL]
case inl
E : Type u_1
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace ℝ E
inst✝⁷ : MeasurableSpace E
inst✝⁶ : BorelSpace E
inst✝⁵ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁴ : IsAddHaarMeasure μ
F : Type u_2
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
s : Set E
inst✝ : Nontrivial E
x : E
⊢ ↑↑μ (sphere x 0) = 0
[PROOFSTEP]
rw [sphere_zero, measure_singleton]
[GOAL]
case inr
E : Type u_1
inst✝⁹ : NormedAddCommGroup E
inst✝⁸ : NormedSpace ℝ E
inst✝⁷ : MeasurableSpace E
inst✝⁶ : BorelSpace E
inst✝⁵ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁴ : IsAddHaarMeasure μ
F : Type u_2
inst✝³ : NormedAddCommGroup F
inst✝² : NormedSpace ℝ F
inst✝¹ : CompleteSpace F
s : Set E
inst✝ : Nontrivial E
x : E
r : ℝ
h : r ≠ 0
⊢ ↑↑μ (sphere x r) = 0
[PROOFSTEP]
exact addHaar_sphere_of_ne_zero μ x h
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
r : ℝ
hr : r ≠ 0
x y : E
s t : Set E
⊢ ↑↑μ ({x} + r • s) / ↑↑μ ({y} + r • t) =
ENNReal.ofReal (|r| ^ finrank ℝ E) * ↑↑μ s * (ENNReal.ofReal (|r| ^ finrank ℝ E) * ↑↑μ t)⁻¹
[PROOFSTEP]
simp only [div_eq_mul_inv, addHaar_smul, image_add_left, measure_preimage_add, abs_pow, singleton_add]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
r : ℝ
hr : r ≠ 0
x y : E
s t : Set E
⊢ ENNReal.ofReal (|r| ^ finrank ℝ E) * ↑↑μ s * (ENNReal.ofReal (|r| ^ finrank ℝ E) * ↑↑μ t)⁻¹ =
ENNReal.ofReal (|r| ^ finrank ℝ E) * (ENNReal.ofReal (|r| ^ finrank ℝ E))⁻¹ * (↑↑μ s * (↑↑μ t)⁻¹)
[PROOFSTEP]
rw [ENNReal.mul_inv]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
r : ℝ
hr : r ≠ 0
x y : E
s t : Set E
⊢ ENNReal.ofReal (|r| ^ finrank ℝ E) * ↑↑μ s * ((ENNReal.ofReal (|r| ^ finrank ℝ E))⁻¹ * (↑↑μ t)⁻¹) =
ENNReal.ofReal (|r| ^ finrank ℝ E) * (ENNReal.ofReal (|r| ^ finrank ℝ E))⁻¹ * (↑↑μ s * (↑↑μ t)⁻¹)
[PROOFSTEP]
ring
[GOAL]
case ha
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
r : ℝ
hr : r ≠ 0
x y : E
s t : Set E
⊢ ENNReal.ofReal (|r| ^ finrank ℝ E) ≠ 0 ∨ ↑↑μ t ≠ ⊤
[PROOFSTEP]
simp only [pow_pos (abs_pos.mpr hr), ENNReal.ofReal_eq_zero, not_le, Ne.def, true_or_iff]
[GOAL]
case hb
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
r : ℝ
hr : r ≠ 0
x y : E
s t : Set E
⊢ ENNReal.ofReal (|r| ^ finrank ℝ E) ≠ ⊤ ∨ ↑↑μ t ≠ 0
[PROOFSTEP]
simp only [ENNReal.ofReal_ne_top, true_or_iff, Ne.def, not_false_iff]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
r : ℝ
hr : r ≠ 0
x y : E
s t : Set E
⊢ ENNReal.ofReal (|r| ^ finrank ℝ E) * (ENNReal.ofReal (|r| ^ finrank ℝ E))⁻¹ * (↑↑μ s * (↑↑μ t)⁻¹) = ↑↑μ s / ↑↑μ t
[PROOFSTEP]
rw [ENNReal.mul_inv_cancel, one_mul, div_eq_mul_inv]
[GOAL]
case h0
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
r : ℝ
hr : r ≠ 0
x y : E
s t : Set E
⊢ ENNReal.ofReal (|r| ^ finrank ℝ E) ≠ 0
[PROOFSTEP]
simp only [pow_pos (abs_pos.mpr hr), ENNReal.ofReal_eq_zero, not_le, Ne.def]
[GOAL]
case ht
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ : Set E
r : ℝ
hr : r ≠ 0
x y : E
s t : Set E
⊢ ENNReal.ofReal (|r| ^ finrank ℝ E) ≠ ⊤
[PROOFSTEP]
simp only [ENNReal.ofReal_ne_top, Ne.def, not_false_iff]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
⊢ IsUnifLocDoublingMeasure μ
[PROOFSTEP]
refine' ⟨⟨(2 : ℝ≥0) ^ finrank ℝ E, _⟩⟩
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
⊢ ∀ᶠ (ε : ℝ) in 𝓝[Ioi 0] 0, ∀ (x : E), ↑↑μ (closedBall x (2 * ε)) ≤ ↑(2 ^ finrank ℝ E) * ↑↑μ (closedBall x ε)
[PROOFSTEP]
filter_upwards [self_mem_nhdsWithin] with r hr x
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
r : ℝ
hr : r ∈ Ioi 0
x : E
⊢ ↑↑μ (closedBall x (2 * r)) ≤ ↑(2 ^ finrank ℝ E) * ↑↑μ (closedBall x r)
[PROOFSTEP]
rw [addHaar_closedBall_mul μ x zero_le_two (le_of_lt hr), addHaar_closedBall_center μ x, ENNReal.ofReal,
Real.toNNReal_pow zero_le_two]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s : Set E
r : ℝ
hr : r ∈ Ioi 0
x : E
⊢ ↑(Real.toNNReal 2 ^ finrank ℝ E) * ↑↑μ (closedBall 0 r) ≤ ↑(2 ^ finrank ℝ E) * ↑↑μ (closedBall 0 r)
[PROOFSTEP]
simp only [Real.toNNReal_ofNat, le_refl]
[GOAL]
E : Type u_1
inst✝¹⁴ : NormedAddCommGroup E
inst✝¹³ : NormedSpace ℝ E
inst✝¹² : MeasurableSpace E
inst✝¹¹ : BorelSpace E
inst✝¹⁰ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁹ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace ℝ F
inst✝⁶ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁵ : Fintype ι
inst✝⁴ : DecidableEq ι
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace ℝ G
inst✝¹ : MeasurableSpace G
inst✝ : BorelSpace G
b : Basis ι ℝ G
v : ι → G
⊢ ↑↑(Basis.addHaar b) (parallelepiped v) = ENNReal.ofReal |↑(Basis.det b) v|
[PROOFSTEP]
have : FiniteDimensional ℝ G := FiniteDimensional.of_fintype_basis b
[GOAL]
E : Type u_1
inst✝¹⁴ : NormedAddCommGroup E
inst✝¹³ : NormedSpace ℝ E
inst✝¹² : MeasurableSpace E
inst✝¹¹ : BorelSpace E
inst✝¹⁰ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁹ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace ℝ F
inst✝⁶ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁵ : Fintype ι
inst✝⁴ : DecidableEq ι
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace ℝ G
inst✝¹ : MeasurableSpace G
inst✝ : BorelSpace G
b : Basis ι ℝ G
v : ι → G
this : FiniteDimensional ℝ G
⊢ ↑↑(Basis.addHaar b) (parallelepiped v) = ENNReal.ofReal |↑(Basis.det b) v|
[PROOFSTEP]
have A : parallelepiped v = b.constr ℕ v '' parallelepiped b :=
by
rw [image_parallelepiped]
-- porting note: was `congr 1 with i` but Lean 4 `congr` applies `ext` first
refine congr_arg _ <| funext fun i ↦ ?_
exact (b.constr_basis ℕ v i).symm
[GOAL]
E : Type u_1
inst✝¹⁴ : NormedAddCommGroup E
inst✝¹³ : NormedSpace ℝ E
inst✝¹² : MeasurableSpace E
inst✝¹¹ : BorelSpace E
inst✝¹⁰ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁹ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace ℝ F
inst✝⁶ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁵ : Fintype ι
inst✝⁴ : DecidableEq ι
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace ℝ G
inst✝¹ : MeasurableSpace G
inst✝ : BorelSpace G
b : Basis ι ℝ G
v : ι → G
this : FiniteDimensional ℝ G
⊢ parallelepiped v = ↑(↑(Basis.constr b ℕ) v) '' parallelepiped ↑b
[PROOFSTEP]
rw [image_parallelepiped]
-- porting note: was `congr 1 with i` but Lean 4 `congr` applies `ext` first
[GOAL]
E : Type u_1
inst✝¹⁴ : NormedAddCommGroup E
inst✝¹³ : NormedSpace ℝ E
inst✝¹² : MeasurableSpace E
inst✝¹¹ : BorelSpace E
inst✝¹⁰ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁹ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace ℝ F
inst✝⁶ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁵ : Fintype ι
inst✝⁴ : DecidableEq ι
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace ℝ G
inst✝¹ : MeasurableSpace G
inst✝ : BorelSpace G
b : Basis ι ℝ G
v : ι → G
this : FiniteDimensional ℝ G
⊢ parallelepiped v = parallelepiped (↑(↑(Basis.constr b ℕ) v) ∘ ↑b)
[PROOFSTEP]
refine congr_arg _ <| funext fun i ↦ ?_
[GOAL]
E : Type u_1
inst✝¹⁴ : NormedAddCommGroup E
inst✝¹³ : NormedSpace ℝ E
inst✝¹² : MeasurableSpace E
inst✝¹¹ : BorelSpace E
inst✝¹⁰ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁹ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace ℝ F
inst✝⁶ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁵ : Fintype ι
inst✝⁴ : DecidableEq ι
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace ℝ G
inst✝¹ : MeasurableSpace G
inst✝ : BorelSpace G
b : Basis ι ℝ G
v : ι → G
this : FiniteDimensional ℝ G
i : ι
⊢ v i = (↑(↑(Basis.constr b ℕ) v) ∘ ↑b) i
[PROOFSTEP]
exact (b.constr_basis ℕ v i).symm
[GOAL]
E : Type u_1
inst✝¹⁴ : NormedAddCommGroup E
inst✝¹³ : NormedSpace ℝ E
inst✝¹² : MeasurableSpace E
inst✝¹¹ : BorelSpace E
inst✝¹⁰ : FiniteDimensional ℝ E
μ : Measure E
inst✝⁹ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁸ : NormedAddCommGroup F
inst✝⁷ : NormedSpace ℝ F
inst✝⁶ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁵ : Fintype ι
inst✝⁴ : DecidableEq ι
inst✝³ : NormedAddCommGroup G
inst✝² : NormedSpace ℝ G
inst✝¹ : MeasurableSpace G
inst✝ : BorelSpace G
b : Basis ι ℝ G
v : ι → G
this : FiniteDimensional ℝ G
A : parallelepiped v = ↑(↑(Basis.constr b ℕ) v) '' parallelepiped ↑b
⊢ ↑↑(Basis.addHaar b) (parallelepiped v) = ENNReal.ofReal |↑(Basis.det b) v|
[PROOFSTEP]
rw [A, addHaar_image_linearMap, b.addHaar_self, mul_one, ← LinearMap.det_toMatrix b, ←
Basis.toMatrix_eq_toMatrix_constr, Basis.det_apply]
[GOAL]
E : Type u_1
inst✝¹⁵ : NormedAddCommGroup E
inst✝¹⁴ : NormedSpace ℝ E
inst✝¹³ : MeasurableSpace E
inst✝¹² : BorelSpace E
inst✝¹¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝¹⁰ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace ℝ F
inst✝⁷ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁶ : Fintype ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : NormedAddCommGroup G
inst✝³ : NormedSpace ℝ G
inst✝² : MeasurableSpace G
inst✝¹ : BorelSpace G
inst✝ : FiniteDimensional ℝ G
n : ℕ
_i : Fact (finrank ℝ G = n)
ω : AlternatingMap ℝ G ℝ (Fin n)
v : Fin n → G
⊢ ↑↑(AlternatingMap.measure ω) (parallelepiped v) = ENNReal.ofReal |↑ω v|
[PROOFSTEP]
conv_rhs => rw [ω.eq_smul_basis_det (finBasisOfFinrankEq ℝ G _i.out)]
[GOAL]
E : Type u_1
inst✝¹⁵ : NormedAddCommGroup E
inst✝¹⁴ : NormedSpace ℝ E
inst✝¹³ : MeasurableSpace E
inst✝¹² : BorelSpace E
inst✝¹¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝¹⁰ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace ℝ F
inst✝⁷ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁶ : Fintype ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : NormedAddCommGroup G
inst✝³ : NormedSpace ℝ G
inst✝² : MeasurableSpace G
inst✝¹ : BorelSpace G
inst✝ : FiniteDimensional ℝ G
n : ℕ
_i : Fact (finrank ℝ G = n)
ω : AlternatingMap ℝ G ℝ (Fin n)
v : Fin n → G
| ENNReal.ofReal |↑ω v|
[PROOFSTEP]
rw [ω.eq_smul_basis_det (finBasisOfFinrankEq ℝ G _i.out)]
[GOAL]
E : Type u_1
inst✝¹⁵ : NormedAddCommGroup E
inst✝¹⁴ : NormedSpace ℝ E
inst✝¹³ : MeasurableSpace E
inst✝¹² : BorelSpace E
inst✝¹¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝¹⁰ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace ℝ F
inst✝⁷ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁶ : Fintype ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : NormedAddCommGroup G
inst✝³ : NormedSpace ℝ G
inst✝² : MeasurableSpace G
inst✝¹ : BorelSpace G
inst✝ : FiniteDimensional ℝ G
n : ℕ
_i : Fact (finrank ℝ G = n)
ω : AlternatingMap ℝ G ℝ (Fin n)
v : Fin n → G
| ENNReal.ofReal |↑ω v|
[PROOFSTEP]
rw [ω.eq_smul_basis_det (finBasisOfFinrankEq ℝ G _i.out)]
[GOAL]
E : Type u_1
inst✝¹⁵ : NormedAddCommGroup E
inst✝¹⁴ : NormedSpace ℝ E
inst✝¹³ : MeasurableSpace E
inst✝¹² : BorelSpace E
inst✝¹¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝¹⁰ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace ℝ F
inst✝⁷ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁶ : Fintype ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : NormedAddCommGroup G
inst✝³ : NormedSpace ℝ G
inst✝² : MeasurableSpace G
inst✝¹ : BorelSpace G
inst✝ : FiniteDimensional ℝ G
n : ℕ
_i : Fact (finrank ℝ G = n)
ω : AlternatingMap ℝ G ℝ (Fin n)
v : Fin n → G
| ENNReal.ofReal |↑ω v|
[PROOFSTEP]
rw [ω.eq_smul_basis_det (finBasisOfFinrankEq ℝ G _i.out)]
[GOAL]
E : Type u_1
inst✝¹⁵ : NormedAddCommGroup E
inst✝¹⁴ : NormedSpace ℝ E
inst✝¹³ : MeasurableSpace E
inst✝¹² : BorelSpace E
inst✝¹¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝¹⁰ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace ℝ F
inst✝⁷ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁶ : Fintype ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : NormedAddCommGroup G
inst✝³ : NormedSpace ℝ G
inst✝² : MeasurableSpace G
inst✝¹ : BorelSpace G
inst✝ : FiniteDimensional ℝ G
n : ℕ
_i : Fact (finrank ℝ G = n)
ω : AlternatingMap ℝ G ℝ (Fin n)
v : Fin n → G
⊢ ↑↑(AlternatingMap.measure ω) (parallelepiped v) =
ENNReal.ofReal
|↑(↑ω ↑(finBasisOfFinrankEq ℝ G (_ : finrank ℝ G = n)) •
Basis.det (finBasisOfFinrankEq ℝ G (_ : finrank ℝ G = n)))
v|
[PROOFSTEP]
simp only [addHaar_parallelepiped, AlternatingMap.measure, coe_nnreal_smul_apply, AlternatingMap.smul_apply,
Algebra.id.smul_eq_mul, abs_mul, ENNReal.ofReal_mul (abs_nonneg _), Real.ennnorm_eq_ofReal_abs]
[GOAL]
E : Type u_1
inst✝¹⁵ : NormedAddCommGroup E
inst✝¹⁴ : NormedSpace ℝ E
inst✝¹³ : MeasurableSpace E
inst✝¹² : BorelSpace E
inst✝¹¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝¹⁰ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace ℝ F
inst✝⁷ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁶ : Fintype ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : NormedAddCommGroup G
inst✝³ : NormedSpace ℝ G
inst✝² : MeasurableSpace G
inst✝¹ : BorelSpace G
inst✝ : FiniteDimensional ℝ G
n : ℕ
_i : Fact (finrank ℝ G = n)
ω : AlternatingMap ℝ G ℝ (Fin n)
⊢ IsAddLeftInvariant (AlternatingMap.measure ω)
[PROOFSTEP]
rw [AlternatingMap.measure]
[GOAL]
E : Type u_1
inst✝¹⁵ : NormedAddCommGroup E
inst✝¹⁴ : NormedSpace ℝ E
inst✝¹³ : MeasurableSpace E
inst✝¹² : BorelSpace E
inst✝¹¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝¹⁰ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace ℝ F
inst✝⁷ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁶ : Fintype ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : NormedAddCommGroup G
inst✝³ : NormedSpace ℝ G
inst✝² : MeasurableSpace G
inst✝¹ : BorelSpace G
inst✝ : FiniteDimensional ℝ G
n : ℕ
_i : Fact (finrank ℝ G = n)
ω : AlternatingMap ℝ G ℝ (Fin n)
⊢ IsAddLeftInvariant
(‖↑ω ↑(finBasisOfFinrankEq ℝ G (_ : finrank ℝ G = n))‖₊ •
Basis.addHaar (finBasisOfFinrankEq ℝ G (_ : finrank ℝ G = n)))
[PROOFSTEP]
infer_instance
[GOAL]
E : Type u_1
inst✝¹⁵ : NormedAddCommGroup E
inst✝¹⁴ : NormedSpace ℝ E
inst✝¹³ : MeasurableSpace E
inst✝¹² : BorelSpace E
inst✝¹¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝¹⁰ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace ℝ F
inst✝⁷ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁶ : Fintype ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : NormedAddCommGroup G
inst✝³ : NormedSpace ℝ G
inst✝² : MeasurableSpace G
inst✝¹ : BorelSpace G
inst✝ : FiniteDimensional ℝ G
n : ℕ
_i : Fact (finrank ℝ G = n)
ω : AlternatingMap ℝ G ℝ (Fin n)
⊢ IsLocallyFiniteMeasure (AlternatingMap.measure ω)
[PROOFSTEP]
rw [AlternatingMap.measure]
[GOAL]
E : Type u_1
inst✝¹⁵ : NormedAddCommGroup E
inst✝¹⁴ : NormedSpace ℝ E
inst✝¹³ : MeasurableSpace E
inst✝¹² : BorelSpace E
inst✝¹¹ : FiniteDimensional ℝ E
μ : Measure E
inst✝¹⁰ : IsAddHaarMeasure μ
F : Type u_2
inst✝⁹ : NormedAddCommGroup F
inst✝⁸ : NormedSpace ℝ F
inst✝⁷ : CompleteSpace F
s : Set E
ι : Type u_3
G : Type u_4
inst✝⁶ : Fintype ι
inst✝⁵ : DecidableEq ι
inst✝⁴ : NormedAddCommGroup G
inst✝³ : NormedSpace ℝ G
inst✝² : MeasurableSpace G
inst✝¹ : BorelSpace G
inst✝ : FiniteDimensional ℝ G
n : ℕ
_i : Fact (finrank ℝ G = n)
ω : AlternatingMap ℝ G ℝ (Fin n)
⊢ IsLocallyFiniteMeasure
(‖↑ω ↑(finBasisOfFinrankEq ℝ G (_ : finrank ℝ G = n))‖₊ •
Basis.addHaar (finBasisOfFinrankEq ℝ G (_ : finrank ℝ G = n)))
[PROOFSTEP]
infer_instance
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
have A : Tendsto (fun r : ℝ => μ (s ∩ ({ x } + r • t)) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 0) :=
by
apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds h (eventually_of_forall fun b => zero_le _)
filter_upwards [self_mem_nhdsWithin]
rintro r (rpos : 0 < r)
apply mul_le_mul_right' (measure_mono (inter_subset_inter_right _ _)) _
intro y hy
have : y - x ∈ r • closedBall (0 : E) 1 := by
apply smul_set_mono t_bound
simpa [neg_add_eq_sub] using hy
simpa only [smul_closedBall _ _ zero_le_one, Real.norm_of_nonneg rpos.le, mem_closedBall_iff_norm, mul_one, sub_zero,
smul_zero]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
apply tendsto_of_tendsto_of_tendsto_of_le_of_le' tendsto_const_nhds h (eventually_of_forall fun b => zero_le _)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
⊢ ∀ᶠ (b : ℝ) in 𝓝[Ioi 0] 0,
↑↑μ (s ∩ ({x} + b • t)) / ↑↑μ (closedBall x b) ≤ ↑↑μ (s ∩ closedBall x b) / ↑↑μ (closedBall x b)
[PROOFSTEP]
filter_upwards [self_mem_nhdsWithin]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
⊢ ∀ (a : ℝ),
a ∈ Ioi 0 → ↑↑μ (s ∩ ({x} + a • t)) / ↑↑μ (closedBall x a) ≤ ↑↑μ (s ∩ closedBall x a) / ↑↑μ (closedBall x a)
[PROOFSTEP]
rintro r (rpos : 0 < r)
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
r : ℝ
rpos : 0 < r
⊢ ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r) ≤ ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)
[PROOFSTEP]
apply mul_le_mul_right' (measure_mono (inter_subset_inter_right _ _)) _
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
r : ℝ
rpos : 0 < r
⊢ {x} + r • t ⊆ closedBall x r
[PROOFSTEP]
intro y hy
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
r : ℝ
rpos : 0 < r
y : E
hy : y ∈ {x} + r • t
⊢ y ∈ closedBall x r
[PROOFSTEP]
have : y - x ∈ r • closedBall (0 : E) 1 := by
apply smul_set_mono t_bound
simpa [neg_add_eq_sub] using hy
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
r : ℝ
rpos : 0 < r
y : E
hy : y ∈ {x} + r • t
⊢ y - x ∈ r • closedBall 0 1
[PROOFSTEP]
apply smul_set_mono t_bound
[GOAL]
case a
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
r : ℝ
rpos : 0 < r
y : E
hy : y ∈ {x} + r • t
⊢ y - x ∈ r • t
[PROOFSTEP]
simpa [neg_add_eq_sub] using hy
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
r : ℝ
rpos : 0 < r
y : E
hy : y ∈ {x} + r • t
this : y - x ∈ r • closedBall 0 1
⊢ y ∈ closedBall x r
[PROOFSTEP]
simpa only [smul_closedBall _ _ zero_le_one, Real.norm_of_nonneg rpos.le, mem_closedBall_iff_norm, mul_one, sub_zero,
smul_zero]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
have B :
Tendsto (fun r : ℝ => μ (closedBall x r) / μ ({ x } + r • u)) (𝓝[>] 0) (𝓝 (μ (closedBall x 1) / μ ({ x } + u))) :=
by
apply tendsto_const_nhds.congr' _
filter_upwards [self_mem_nhdsWithin]
rintro r (rpos : 0 < r)
have : closedBall x r = { x } + r • closedBall (0 : E) 1 := by
simp only [_root_.smul_closedBall, Real.norm_of_nonneg rpos.le, zero_le_one, add_zero, mul_one,
singleton_add_closedBall, smul_zero]
simp only [this, addHaar_singleton_add_smul_div_singleton_add_smul μ rpos.ne']
simp only [addHaar_closedBall_center, image_add_left, measure_preimage_add, singleton_add]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)))
[PROOFSTEP]
apply tendsto_const_nhds.congr' _
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ (fun x_1 => ↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)) =ᶠ[𝓝[Ioi 0] 0] fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)
[PROOFSTEP]
filter_upwards [self_mem_nhdsWithin]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ ∀ (a : ℝ), a ∈ Ioi 0 → ↑↑μ (closedBall x 1) / ↑↑μ ({x} + u) = ↑↑μ (closedBall x a) / ↑↑μ ({x} + a • u)
[PROOFSTEP]
rintro r (rpos : 0 < r)
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
rpos : 0 < r
⊢ ↑↑μ (closedBall x 1) / ↑↑μ ({x} + u) = ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)
[PROOFSTEP]
have : closedBall x r = { x } + r • closedBall (0 : E) 1 := by
simp only [_root_.smul_closedBall, Real.norm_of_nonneg rpos.le, zero_le_one, add_zero, mul_one,
singleton_add_closedBall, smul_zero]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
rpos : 0 < r
⊢ closedBall x r = {x} + r • closedBall 0 1
[PROOFSTEP]
simp only [_root_.smul_closedBall, Real.norm_of_nonneg rpos.le, zero_le_one, add_zero, mul_one,
singleton_add_closedBall, smul_zero]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
rpos : 0 < r
this : closedBall x r = {x} + r • closedBall 0 1
⊢ ↑↑μ (closedBall x 1) / ↑↑μ ({x} + u) = ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)
[PROOFSTEP]
simp only [this, addHaar_singleton_add_smul_div_singleton_add_smul μ rpos.ne']
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
rpos : 0 < r
this : closedBall x r = {x} + r • closedBall 0 1
⊢ ↑↑μ (closedBall x 1) / ↑↑μ ({x} + u) = ↑↑μ (closedBall 0 1) / ↑↑μ u
[PROOFSTEP]
simp only [addHaar_closedBall_center, image_add_left, measure_preimage_add, singleton_add]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)))
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
have C :
Tendsto (fun r : ℝ => μ (s ∩ ({ x } + r • t)) / μ (closedBall x r) * (μ (closedBall x r) / μ ({ x } + r • u)))
(𝓝[>] 0) (𝓝 (0 * (μ (closedBall x 1) / μ ({ x } + u)))) :=
by
apply ENNReal.Tendsto.mul A _ B (Or.inr ENNReal.zero_ne_top)
simp only [ne_eq, not_true, singleton_add, image_add_left, measure_preimage_add, false_or, ENNReal.div_eq_top, h'u,
false_or_iff, not_and, and_false_iff]
intro aux
exact (measure_closedBall_lt_top.ne aux).elim
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)))
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r) * (↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)))
(𝓝[Ioi 0] 0) (𝓝 (0 * (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u))))
[PROOFSTEP]
apply ENNReal.Tendsto.mul A _ B (Or.inr ENNReal.zero_ne_top)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)))
⊢ 0 ≠ 0 ∨ ↑↑μ (closedBall x 1) / ↑↑μ ({x} + u) ≠ ⊤
[PROOFSTEP]
simp only [ne_eq, not_true, singleton_add, image_add_left, measure_preimage_add, false_or, ENNReal.div_eq_top, h'u,
false_or_iff, not_and, and_false_iff]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)))
⊢ ↑↑μ (closedBall x 1) = ⊤ → ¬¬↑↑μ u = ⊤
[PROOFSTEP]
intro aux
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)))
aux : ↑↑μ (closedBall x 1) = ⊤
⊢ ¬¬↑↑μ u = ⊤
[PROOFSTEP]
exact (measure_closedBall_lt_top.ne aux).elim
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)))
C :
Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r) * (↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)))
(𝓝[Ioi 0] 0) (𝓝 (0 * (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u))))
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
simp only [zero_mul] at C
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)))
C :
Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r) * (↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)))
(𝓝[Ioi 0] 0) (𝓝 0)
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
apply C.congr' _
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)))
C :
Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r) * (↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)))
(𝓝[Ioi 0] 0) (𝓝 0)
⊢ (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r) * (↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u))) =ᶠ[𝓝[Ioi 0] 0]
fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)
[PROOFSTEP]
filter_upwards [self_mem_nhdsWithin]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)))
C :
Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r) * (↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)))
(𝓝[Ioi 0] 0) (𝓝 0)
⊢ ∀ (a : ℝ),
a ∈ Ioi 0 →
↑↑μ (s ∩ ({x} + a • t)) / ↑↑μ (closedBall x a) * (↑↑μ (closedBall x a) / ↑↑μ ({x} + a • u)) =
↑↑μ (s ∩ ({x} + a • t)) / ↑↑μ ({x} + a • u)
[PROOFSTEP]
rintro r (rpos : 0 < r)
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)))
C :
Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r) * (↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)))
(𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
rpos : 0 < r
⊢ ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r) * (↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) =
↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)
[PROOFSTEP]
calc
μ (s ∩ ({ x } + r • t)) / μ (closedBall x r) * (μ (closedBall x r) / μ ({ x } + r • u)) =
μ (closedBall x r) * (μ (closedBall x r))⁻¹ * (μ (s ∩ ({ x } + r • t)) / μ ({ x } + r • u)) :=
by simp only [div_eq_mul_inv]; ring
_ = μ (s ∩ ({ x } + r • t)) / μ ({ x } + r • u) := by
rw [ENNReal.mul_inv_cancel (measure_closedBall_pos μ x rpos).ne' measure_closedBall_lt_top.ne, one_mul]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)))
C :
Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r) * (↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)))
(𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
rpos : 0 < r
⊢ ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r) * (↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) =
↑↑μ (closedBall x r) * (↑↑μ (closedBall x r))⁻¹ * (↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u))
[PROOFSTEP]
simp only [div_eq_mul_inv]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)))
C :
Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r) * (↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)))
(𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
rpos : 0 < r
⊢ ↑↑μ (s ∩ ({x} + r • t)) * (↑↑μ (closedBall x r))⁻¹ * (↑↑μ (closedBall x r) * (↑↑μ ({x} + r • u))⁻¹) =
↑↑μ (closedBall x r) * (↑↑μ (closedBall x r))⁻¹ * (↑↑μ (s ∩ ({x} + r • t)) * (↑↑μ ({x} + r • u))⁻¹)
[PROOFSTEP]
ring
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
t_bound : t ⊆ closedBall 0 1
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 (↑↑μ (closedBall x 1) / ↑↑μ ({x} + u)))
C :
Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ (closedBall x r) * (↑↑μ (closedBall x r) / ↑↑μ ({x} + r • u)))
(𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
rpos : 0 < r
⊢ ↑↑μ (closedBall x r) * (↑↑μ (closedBall x r))⁻¹ * (↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)) =
↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)
[PROOFSTEP]
rw [ENNReal.mul_inv_cancel (measure_closedBall_pos μ x rpos).ne' measure_closedBall_lt_top.ne, one_mul]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
set t' := R⁻¹ • t with ht'
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
set u' := R⁻¹ • u with hu'
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
have A : Tendsto (fun r : ℝ => μ (s ∩ ({ x } + r • t')) / μ ({ x } + r • u')) (𝓝[>] 0) (𝓝 0) :=
by
apply tendsto_addHaar_inter_smul_zero_of_density_zero_aux1 μ s x h t' u'
·
simp only [h'u, (pow_pos Rpos _).ne', abs_nonpos_iff, addHaar_smul, not_false_iff, ENNReal.ofReal_eq_zero,
inv_eq_zero, inv_pow, Ne.def, or_self_iff, mul_eq_zero]
· refine (smul_set_mono t_bound).trans_eq ?_
rw [smul_closedBall _ _ Rpos.le, smul_zero, Real.norm_of_nonneg (inv_nonneg.2 Rpos.le), inv_mul_cancel Rpos.ne']
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
apply tendsto_addHaar_inter_smul_zero_of_density_zero_aux1 μ s x h t' u'
[GOAL]
case h'u
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
⊢ ↑↑μ u' ≠ 0
[PROOFSTEP]
simp only [h'u, (pow_pos Rpos _).ne', abs_nonpos_iff, addHaar_smul, not_false_iff, ENNReal.ofReal_eq_zero, inv_eq_zero,
inv_pow, Ne.def, or_self_iff, mul_eq_zero]
[GOAL]
case t_bound
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
⊢ t' ⊆ closedBall 0 1
[PROOFSTEP]
refine (smul_set_mono t_bound).trans_eq ?_
[GOAL]
case t_bound
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
⊢ R⁻¹ • closedBall 0 R = closedBall 0 1
[PROOFSTEP]
rw [smul_closedBall _ _ Rpos.le, smul_zero, Real.norm_of_nonneg (inv_nonneg.2 Rpos.le), inv_mul_cancel Rpos.ne']
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
have B : Tendsto (fun r : ℝ => R * r) (𝓝[>] 0) (𝓝[>] (R * 0)) :=
by
apply tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within
· exact (tendsto_const_nhds.mul tendsto_id).mono_left nhdsWithin_le_nhds
· filter_upwards [self_mem_nhdsWithin]
intro r rpos
rw [mul_zero]
exact mul_pos Rpos rpos
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ Tendsto (fun r => R * r) (𝓝[Ioi 0] 0) (𝓝[Ioi (R * 0)] (R * 0))
[PROOFSTEP]
apply tendsto_nhdsWithin_of_tendsto_nhds_of_eventually_within
[GOAL]
case h1
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ Tendsto (fun r => R * r) (𝓝[Ioi 0] 0) (𝓝 (R * 0))
[PROOFSTEP]
exact (tendsto_const_nhds.mul tendsto_id).mono_left nhdsWithin_le_nhds
[GOAL]
case h2
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ ∀ᶠ (x : ℝ) in 𝓝[Ioi 0] 0, R * x ∈ Ioi (R * 0)
[PROOFSTEP]
filter_upwards [self_mem_nhdsWithin]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ ∀ (a : ℝ), a ∈ Ioi 0 → R * a ∈ Ioi (R * 0)
[PROOFSTEP]
intro r rpos
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
rpos : r ∈ Ioi 0
⊢ R * r ∈ Ioi (R * 0)
[PROOFSTEP]
rw [mul_zero]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
rpos : r ∈ Ioi 0
⊢ R * r ∈ Ioi 0
[PROOFSTEP]
exact mul_pos Rpos rpos
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => R * r) (𝓝[Ioi 0] 0) (𝓝[Ioi (R * 0)] (R * 0))
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
rw [mul_zero] at B
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => R * r) (𝓝[Ioi 0] 0) (𝓝[Ioi 0] 0)
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
apply (A.comp B).congr' _
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => R * r) (𝓝[Ioi 0] 0) (𝓝[Ioi 0] 0)
⊢ ((fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) ∘ fun r => R * r) =ᶠ[𝓝[Ioi 0] 0] fun r =>
↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)
[PROOFSTEP]
filter_upwards [self_mem_nhdsWithin]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => R * r) (𝓝[Ioi 0] 0) (𝓝[Ioi 0] 0)
⊢ ∀ (a : ℝ),
a ∈ Ioi 0 →
((fun r => ↑↑μ (s ∩ ({x} + r • R⁻¹ • t)) / ↑↑μ ({x} + r • R⁻¹ • u)) ∘ fun r => R * r) a =
↑↑μ (s ∩ ({x} + a • t)) / ↑↑μ ({x} + a • u)
[PROOFSTEP]
rintro r -
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => R * r) (𝓝[Ioi 0] 0) (𝓝[Ioi 0] 0)
r : ℝ
⊢ ((fun r => ↑↑μ (s ∩ ({x} + r • R⁻¹ • t)) / ↑↑μ ({x} + r • R⁻¹ • u)) ∘ fun r => R * r) r =
↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)
[PROOFSTEP]
have T : (R * r) • t' = r • t := by rw [mul_comm, ht', smul_smul, mul_assoc, mul_inv_cancel Rpos.ne', mul_one]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => R * r) (𝓝[Ioi 0] 0) (𝓝[Ioi 0] 0)
r : ℝ
⊢ (R * r) • t' = r • t
[PROOFSTEP]
rw [mul_comm, ht', smul_smul, mul_assoc, mul_inv_cancel Rpos.ne', mul_one]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => R * r) (𝓝[Ioi 0] 0) (𝓝[Ioi 0] 0)
r : ℝ
T : (R * r) • t' = r • t
⊢ ((fun r => ↑↑μ (s ∩ ({x} + r • R⁻¹ • t)) / ↑↑μ ({x} + r • R⁻¹ • u)) ∘ fun r => R * r) r =
↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)
[PROOFSTEP]
have U : (R * r) • u' = r • u := by rw [mul_comm, hu', smul_smul, mul_assoc, mul_inv_cancel Rpos.ne', mul_one]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => R * r) (𝓝[Ioi 0] 0) (𝓝[Ioi 0] 0)
r : ℝ
T : (R * r) • t' = r • t
⊢ (R * r) • u' = r • u
[PROOFSTEP]
rw [mul_comm, hu', smul_smul, mul_assoc, mul_inv_cancel Rpos.ne', mul_one]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => R * r) (𝓝[Ioi 0] 0) (𝓝[Ioi 0] 0)
r : ℝ
T : (R * r) • t' = r • t
U : (R * r) • u' = r • u
⊢ ((fun r => ↑↑μ (s ∩ ({x} + r • R⁻¹ • t)) / ↑↑μ ({x} + r • R⁻¹ • u)) ∘ fun r => R * r) r =
↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)
[PROOFSTEP]
dsimp
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t u : Set E
h'u : ↑↑μ u ≠ 0
R : ℝ
Rpos : 0 < R
t_bound : t ⊆ closedBall 0 R
t' : Set E := R⁻¹ • t
ht' : t' = R⁻¹ • t
u' : Set E := R⁻¹ • u
hu' : u' = R⁻¹ • u
A : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • u')) (𝓝[Ioi 0] 0) (𝓝 0)
B : Tendsto (fun r => R * r) (𝓝[Ioi 0] 0) (𝓝[Ioi 0] 0)
r : ℝ
T : (R * r) • t' = r • t
U : (R * r) • u' = r • u
⊢ ↑↑μ (s ∩ ({x} + (R * r) • R⁻¹ • t)) / ↑↑μ ({x} + (R * r) • R⁻¹ • u) = ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • u)
[PROOFSTEP]
rw [T, U]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
refine' tendsto_order.2 ⟨fun a' ha' => (ENNReal.not_lt_zero ha').elim, fun ε (εpos : 0 < ε) => _⟩
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
⊢ ∀ᶠ (b : ℝ) in 𝓝[Ioi 0] 0, ↑↑μ (s ∩ ({x} + b • t)) / ↑↑μ ({x} + b • t) < ε
[PROOFSTEP]
rcases eq_or_ne (μ t) 0 with (h't | h't)
[GOAL]
case inl
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t = 0
⊢ ∀ᶠ (b : ℝ) in 𝓝[Ioi 0] 0, ↑↑μ (s ∩ ({x} + b • t)) / ↑↑μ ({x} + b • t) < ε
[PROOFSTEP]
apply eventually_of_forall fun r => ?_
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t = 0
r : ℝ
⊢ ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t) < ε
[PROOFSTEP]
suffices H : μ (s ∩ ({ x } + r • t)) = 0
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t = 0
r : ℝ
H : ↑↑μ (s ∩ ({x} + r • t)) = 0
⊢ ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t) < ε
[PROOFSTEP]
rw [H]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t = 0
r : ℝ
H : ↑↑μ (s ∩ ({x} + r • t)) = 0
⊢ 0 / ↑↑μ ({x} + r • t) < ε
[PROOFSTEP]
simpa only [ENNReal.zero_div] using εpos
[GOAL]
case H
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t = 0
r : ℝ
⊢ ↑↑μ (s ∩ ({x} + r • t)) = 0
[PROOFSTEP]
apply le_antisymm _ (zero_le _)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t = 0
r : ℝ
⊢ ↑↑μ (s ∩ ({x} + r • t)) ≤ 0
[PROOFSTEP]
calc
μ (s ∩ ({ x } + r • t)) ≤ μ ({ x } + r • t) := measure_mono (inter_subset_right _ _)
_ = 0 := by simp only [h't, addHaar_smul, image_add_left, measure_preimage_add, singleton_add, mul_zero]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t = 0
r : ℝ
⊢ ↑↑μ ({x} + r • t) = 0
[PROOFSTEP]
simp only [h't, addHaar_smul, image_add_left, measure_preimage_add, singleton_add, mul_zero]
[GOAL]
case inr
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
⊢ ∀ᶠ (b : ℝ) in 𝓝[Ioi 0] 0, ↑↑μ (s ∩ ({x} + b • t)) / ↑↑μ ({x} + b • t) < ε
[PROOFSTEP]
obtain ⟨n, npos, hn⟩ : ∃ n : ℕ, 0 < n ∧ μ (t \ closedBall 0 n) < ε / 2 * μ t :=
by
have A : Tendsto (fun n : ℕ => μ (t \ closedBall 0 n)) atTop (𝓝 (μ (⋂ n : ℕ, t \ closedBall 0 n))) :=
by
have N : ∃ n : ℕ, μ (t \ closedBall 0 n) ≠ ∞ := ⟨0, ((measure_mono (diff_subset t _)).trans_lt h''t.lt_top).ne⟩
refine' tendsto_measure_iInter (fun n ↦ ht.diff measurableSet_closedBall) (fun m n hmn ↦ _) N
exact diff_subset_diff Subset.rfl (closedBall_subset_closedBall (Nat.cast_le.2 hmn))
have : ⋂ n : ℕ, t \ closedBall 0 n = ∅ := by
simp_rw [diff_eq, ← inter_iInter, iInter_eq_compl_iUnion_compl, compl_compl, iUnion_closedBall_nat, compl_univ,
inter_empty]
simp only [this, measure_empty] at A
have I : 0 < ε / 2 * μ t := ENNReal.mul_pos (ENNReal.half_pos εpos.ne').ne' h't
exact (Eventually.and (Ioi_mem_atTop 0) ((tendsto_order.1 A).2 _ I)).exists
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
⊢ ∃ n, 0 < n ∧ ↑↑μ (t \ closedBall 0 ↑n) < ε / 2 * ↑↑μ t
[PROOFSTEP]
have A : Tendsto (fun n : ℕ => μ (t \ closedBall 0 n)) atTop (𝓝 (μ (⋂ n : ℕ, t \ closedBall 0 n))) :=
by
have N : ∃ n : ℕ, μ (t \ closedBall 0 n) ≠ ∞ := ⟨0, ((measure_mono (diff_subset t _)).trans_lt h''t.lt_top).ne⟩
refine' tendsto_measure_iInter (fun n ↦ ht.diff measurableSet_closedBall) (fun m n hmn ↦ _) N
exact diff_subset_diff Subset.rfl (closedBall_subset_closedBall (Nat.cast_le.2 hmn))
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
⊢ Tendsto (fun n => ↑↑μ (t \ closedBall 0 ↑n)) atTop (𝓝 (↑↑μ (⋂ (n : ℕ), t \ closedBall 0 ↑n)))
[PROOFSTEP]
have N : ∃ n : ℕ, μ (t \ closedBall 0 n) ≠ ∞ := ⟨0, ((measure_mono (diff_subset t _)).trans_lt h''t.lt_top).ne⟩
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
N : ∃ n, ↑↑μ (t \ closedBall 0 ↑n) ≠ ⊤
⊢ Tendsto (fun n => ↑↑μ (t \ closedBall 0 ↑n)) atTop (𝓝 (↑↑μ (⋂ (n : ℕ), t \ closedBall 0 ↑n)))
[PROOFSTEP]
refine' tendsto_measure_iInter (fun n ↦ ht.diff measurableSet_closedBall) (fun m n hmn ↦ _) N
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
N : ∃ n, ↑↑μ (t \ closedBall 0 ↑n) ≠ ⊤
m n : ℕ
hmn : m ≤ n
⊢ t \ closedBall 0 ↑n ≤ t \ closedBall 0 ↑m
[PROOFSTEP]
exact diff_subset_diff Subset.rfl (closedBall_subset_closedBall (Nat.cast_le.2 hmn))
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
A : Tendsto (fun n => ↑↑μ (t \ closedBall 0 ↑n)) atTop (𝓝 (↑↑μ (⋂ (n : ℕ), t \ closedBall 0 ↑n)))
⊢ ∃ n, 0 < n ∧ ↑↑μ (t \ closedBall 0 ↑n) < ε / 2 * ↑↑μ t
[PROOFSTEP]
have : ⋂ n : ℕ, t \ closedBall 0 n = ∅ := by
simp_rw [diff_eq, ← inter_iInter, iInter_eq_compl_iUnion_compl, compl_compl, iUnion_closedBall_nat, compl_univ,
inter_empty]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
A : Tendsto (fun n => ↑↑μ (t \ closedBall 0 ↑n)) atTop (𝓝 (↑↑μ (⋂ (n : ℕ), t \ closedBall 0 ↑n)))
⊢ ⋂ (n : ℕ), t \ closedBall 0 ↑n = ∅
[PROOFSTEP]
simp_rw [diff_eq, ← inter_iInter, iInter_eq_compl_iUnion_compl, compl_compl, iUnion_closedBall_nat, compl_univ,
inter_empty]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
A : Tendsto (fun n => ↑↑μ (t \ closedBall 0 ↑n)) atTop (𝓝 (↑↑μ (⋂ (n : ℕ), t \ closedBall 0 ↑n)))
this : ⋂ (n : ℕ), t \ closedBall 0 ↑n = ∅
⊢ ∃ n, 0 < n ∧ ↑↑μ (t \ closedBall 0 ↑n) < ε / 2 * ↑↑μ t
[PROOFSTEP]
simp only [this, measure_empty] at A
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
this : ⋂ (n : ℕ), t \ closedBall 0 ↑n = ∅
A : Tendsto (fun n => ↑↑μ (t \ closedBall 0 ↑n)) atTop (𝓝 0)
⊢ ∃ n, 0 < n ∧ ↑↑μ (t \ closedBall 0 ↑n) < ε / 2 * ↑↑μ t
[PROOFSTEP]
have I : 0 < ε / 2 * μ t := ENNReal.mul_pos (ENNReal.half_pos εpos.ne').ne' h't
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
this : ⋂ (n : ℕ), t \ closedBall 0 ↑n = ∅
A : Tendsto (fun n => ↑↑μ (t \ closedBall 0 ↑n)) atTop (𝓝 0)
I : 0 < ε / 2 * ↑↑μ t
⊢ ∃ n, 0 < n ∧ ↑↑μ (t \ closedBall 0 ↑n) < ε / 2 * ↑↑μ t
[PROOFSTEP]
exact (Eventually.and (Ioi_mem_atTop 0) ((tendsto_order.1 A).2 _ I)).exists
[GOAL]
case inr.intro.intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
n : ℕ
npos : 0 < n
hn : ↑↑μ (t \ closedBall 0 ↑n) < ε / 2 * ↑↑μ t
⊢ ∀ᶠ (b : ℝ) in 𝓝[Ioi 0] 0, ↑↑μ (s ∩ ({x} + b • t)) / ↑↑μ ({x} + b • t) < ε
[PROOFSTEP]
have L : Tendsto (fun r : ℝ => μ (s ∩ ({ x } + r • (t ∩ closedBall 0 n))) / μ ({ x } + r • t)) (𝓝[>] 0) (𝓝 0) :=
tendsto_addHaar_inter_smul_zero_of_density_zero_aux2 μ s x h _ t h't n (Nat.cast_pos.2 npos) (inter_subset_right _ _)
[GOAL]
case inr.intro.intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
n : ℕ
npos : 0 < n
hn : ↑↑μ (t \ closedBall 0 ↑n) < ε / 2 * ↑↑μ t
L : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ ∀ᶠ (b : ℝ) in 𝓝[Ioi 0] 0, ↑↑μ (s ∩ ({x} + b • t)) / ↑↑μ ({x} + b • t) < ε
[PROOFSTEP]
filter_upwards [(tendsto_order.1 L).2 _ (ENNReal.half_pos εpos.ne'), self_mem_nhdsWithin]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
n : ℕ
npos : 0 < n
hn : ↑↑μ (t \ closedBall 0 ↑n) < ε / 2 * ↑↑μ t
L : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ ∀ (a : ℝ),
↑↑μ (s ∩ ({x} + a • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + a • t) < ε / 2 →
a ∈ Ioi 0 → ↑↑μ (s ∩ ({x} + a • t)) / ↑↑μ ({x} + a • t) < ε
[PROOFSTEP]
rintro r hr (rpos : 0 < r)
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
n : ℕ
npos : 0 < n
hn : ↑↑μ (t \ closedBall 0 ↑n) < ε / 2 * ↑↑μ t
L : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
hr : ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t) < ε / 2
rpos : 0 < r
⊢ ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t) < ε
[PROOFSTEP]
have I : μ (s ∩ ({ x } + r • t)) ≤ μ (s ∩ ({ x } + r • (t ∩ closedBall 0 n))) + μ ({ x } + r • (t \ closedBall 0 n)) :=
calc
μ (s ∩ ({ x } + r • t)) = μ (s ∩ ({ x } + r • (t ∩ closedBall 0 n)) ∪ s ∩ ({ x } + r • (t \ closedBall 0 n))) := by
rw [← inter_union_distrib_left, ← add_union, ← smul_set_union, inter_union_diff]
_ ≤ μ (s ∩ ({ x } + r • (t ∩ closedBall 0 n))) + μ (s ∩ ({ x } + r • (t \ closedBall 0 n))) :=
(measure_union_le _ _)
_ ≤ μ (s ∩ ({ x } + r • (t ∩ closedBall 0 n))) + μ ({ x } + r • (t \ closedBall 0 n)) :=
add_le_add le_rfl (measure_mono (inter_subset_right _ _))
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
n : ℕ
npos : 0 < n
hn : ↑↑μ (t \ closedBall 0 ↑n) < ε / 2 * ↑↑μ t
L : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
hr : ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t) < ε / 2
rpos : 0 < r
⊢ ↑↑μ (s ∩ ({x} + r • t)) = ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n)) ∪ s ∩ ({x} + r • (t \ closedBall 0 ↑n)))
[PROOFSTEP]
rw [← inter_union_distrib_left, ← add_union, ← smul_set_union, inter_union_diff]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
n : ℕ
npos : 0 < n
hn : ↑↑μ (t \ closedBall 0 ↑n) < ε / 2 * ↑↑μ t
L : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
hr : ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t) < ε / 2
rpos : 0 < r
I : ↑↑μ (s ∩ ({x} + r • t)) ≤ ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) + ↑↑μ ({x} + r • (t \ closedBall 0 ↑n))
⊢ ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t) < ε
[PROOFSTEP]
calc
μ (s ∩ ({ x } + r • t)) / μ ({ x } + r • t) ≤
(μ (s ∩ ({ x } + r • (t ∩ closedBall 0 n))) + μ ({ x } + r • (t \ closedBall 0 n))) / μ ({ x } + r • t) :=
mul_le_mul_right' I _
_ < ε / 2 + ε / 2 := by
rw [ENNReal.add_div]
apply ENNReal.add_lt_add hr _
rwa [addHaar_singleton_add_smul_div_singleton_add_smul μ rpos.ne', ENNReal.div_lt_iff (Or.inl h't) (Or.inl h''t)]
_ = ε := ENNReal.add_halves _
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
n : ℕ
npos : 0 < n
hn : ↑↑μ (t \ closedBall 0 ↑n) < ε / 2 * ↑↑μ t
L : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
hr : ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t) < ε / 2
rpos : 0 < r
I : ↑↑μ (s ∩ ({x} + r • t)) ≤ ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) + ↑↑μ ({x} + r • (t \ closedBall 0 ↑n))
⊢ (↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) + ↑↑μ ({x} + r • (t \ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t) <
ε / 2 + ε / 2
[PROOFSTEP]
rw [ENNReal.add_div]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
n : ℕ
npos : 0 < n
hn : ↑↑μ (t \ closedBall 0 ↑n) < ε / 2 * ↑↑μ t
L : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
hr : ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t) < ε / 2
rpos : 0 < r
I : ↑↑μ (s ∩ ({x} + r • t)) ≤ ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) + ↑↑μ ({x} + r • (t \ closedBall 0 ↑n))
⊢ ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t) +
↑↑μ ({x} + r • (t \ closedBall 0 ↑n)) / ↑↑μ ({x} + r • t) <
ε / 2 + ε / 2
[PROOFSTEP]
apply ENNReal.add_lt_add hr _
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
t : Set E
ht : MeasurableSet t
h''t : ↑↑μ t ≠ ⊤
ε : ℝ≥0∞
εpos : 0 < ε
h't : ↑↑μ t ≠ 0
n : ℕ
npos : 0 < n
hn : ↑↑μ (t \ closedBall 0 ↑n) < ε / 2 * ↑↑μ t
L : Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
hr : ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) / ↑↑μ ({x} + r • t) < ε / 2
rpos : 0 < r
I : ↑↑μ (s ∩ ({x} + r • t)) ≤ ↑↑μ (s ∩ ({x} + r • (t ∩ closedBall 0 ↑n))) + ↑↑μ ({x} + r • (t \ closedBall 0 ↑n))
⊢ ↑↑μ ({x} + r • (t \ closedBall 0 ↑n)) / ↑↑μ ({x} + r • t) < ε / 2
[PROOFSTEP]
rwa [addHaar_singleton_add_smul_div_singleton_add_smul μ rpos.ne', ENNReal.div_lt_iff (Or.inl h't) (Or.inl h''t)]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
[PROOFSTEP]
have I : ∀ u v, μ u ≠ 0 → μ u ≠ ∞ → MeasurableSet v → μ u / μ u - μ (vᶜ ∩ u) / μ u = μ (v ∩ u) / μ u :=
by
intro u v uzero utop vmeas
simp_rw [div_eq_mul_inv]
rw [← ENNReal.sub_mul]; swap
· simp only [uzero, ENNReal.inv_eq_top, imp_true_iff, Ne.def, not_false_iff]
congr 1
apply ENNReal.sub_eq_of_add_eq (ne_top_of_le_ne_top utop (measure_mono (inter_subset_right _ _)))
rw [inter_comm _ u, inter_comm _ u]
exact measure_inter_add_diff u vmeas
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
⊢ ∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
[PROOFSTEP]
intro u v uzero utop vmeas
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
u v : Set E
uzero : ↑↑μ u ≠ 0
utop : ↑↑μ u ≠ ⊤
vmeas : MeasurableSet v
⊢ ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
[PROOFSTEP]
simp_rw [div_eq_mul_inv]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
u v : Set E
uzero : ↑↑μ u ≠ 0
utop : ↑↑μ u ≠ ⊤
vmeas : MeasurableSet v
⊢ ↑↑μ u * (↑↑μ u)⁻¹ - ↑↑μ (vᶜ ∩ u) * (↑↑μ u)⁻¹ = ↑↑μ (v ∩ u) * (↑↑μ u)⁻¹
[PROOFSTEP]
rw [← ENNReal.sub_mul]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
u v : Set E
uzero : ↑↑μ u ≠ 0
utop : ↑↑μ u ≠ ⊤
vmeas : MeasurableSet v
⊢ (↑↑μ u - ↑↑μ (vᶜ ∩ u)) * (↑↑μ u)⁻¹ = ↑↑μ (v ∩ u) * (↑↑μ u)⁻¹
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
u v : Set E
uzero : ↑↑μ u ≠ 0
utop : ↑↑μ u ≠ ⊤
vmeas : MeasurableSet v
⊢ 0 < ↑↑μ (vᶜ ∩ u) → ↑↑μ (vᶜ ∩ u) < ↑↑μ u → (↑↑μ u)⁻¹ ≠ ⊤
[PROOFSTEP]
swap
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
u v : Set E
uzero : ↑↑μ u ≠ 0
utop : ↑↑μ u ≠ ⊤
vmeas : MeasurableSet v
⊢ 0 < ↑↑μ (vᶜ ∩ u) → ↑↑μ (vᶜ ∩ u) < ↑↑μ u → (↑↑μ u)⁻¹ ≠ ⊤
[PROOFSTEP]
simp only [uzero, ENNReal.inv_eq_top, imp_true_iff, Ne.def, not_false_iff]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
u v : Set E
uzero : ↑↑μ u ≠ 0
utop : ↑↑μ u ≠ ⊤
vmeas : MeasurableSet v
⊢ (↑↑μ u - ↑↑μ (vᶜ ∩ u)) * (↑↑μ u)⁻¹ = ↑↑μ (v ∩ u) * (↑↑μ u)⁻¹
[PROOFSTEP]
congr 1
[GOAL]
case e_a
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
u v : Set E
uzero : ↑↑μ u ≠ 0
utop : ↑↑μ u ≠ ⊤
vmeas : MeasurableSet v
⊢ ↑↑μ u - ↑↑μ (vᶜ ∩ u) = ↑↑μ (v ∩ u)
[PROOFSTEP]
apply ENNReal.sub_eq_of_add_eq (ne_top_of_le_ne_top utop (measure_mono (inter_subset_right _ _)))
[GOAL]
case e_a
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
u v : Set E
uzero : ↑↑μ u ≠ 0
utop : ↑↑μ u ≠ ⊤
vmeas : MeasurableSet v
⊢ ↑↑μ (v ∩ u) + ↑↑μ (vᶜ ∩ u) = ↑↑μ u
[PROOFSTEP]
rw [inter_comm _ u, inter_comm _ u]
[GOAL]
case e_a
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
u v : Set E
uzero : ↑↑μ u ≠ 0
utop : ↑↑μ u ≠ ⊤
vmeas : MeasurableSet v
⊢ ↑↑μ (u ∩ v) + ↑↑μ (u ∩ vᶜ) = ↑↑μ u
[PROOFSTEP]
exact measure_inter_add_diff u vmeas
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
[PROOFSTEP]
have L : Tendsto (fun r => μ (sᶜ ∩ closedBall x r) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 0) :=
by
have A : Tendsto (fun r => μ (closedBall x r) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 1) :=
by
apply tendsto_const_nhds.congr' _
filter_upwards [self_mem_nhdsWithin]
intro r hr
rw [div_eq_mul_inv, ENNReal.mul_inv_cancel]
· exact (measure_closedBall_pos μ _ hr).ne'
· exact measure_closedBall_lt_top.ne
have B := ENNReal.Tendsto.sub A h (Or.inl ENNReal.one_ne_top)
simp only [tsub_self] at B
apply B.congr' _
filter_upwards [self_mem_nhdsWithin]
rintro r (rpos : 0 < r)
convert I (closedBall x r) sᶜ (measure_closedBall_pos μ _ rpos).ne' measure_closedBall_lt_top.ne hs.compl
rw [compl_compl]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
⊢ Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
have A : Tendsto (fun r => μ (closedBall x r) / μ (closedBall x r)) (𝓝[>] 0) (𝓝 1) :=
by
apply tendsto_const_nhds.congr' _
filter_upwards [self_mem_nhdsWithin]
intro r hr
rw [div_eq_mul_inv, ENNReal.mul_inv_cancel]
· exact (measure_closedBall_pos μ _ hr).ne'
· exact measure_closedBall_lt_top.ne
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
⊢ Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
[PROOFSTEP]
apply tendsto_const_nhds.congr' _
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
⊢ (fun x => 1) =ᶠ[𝓝[Ioi 0] 0] fun r => ↑↑μ (closedBall x r) / ↑↑μ (closedBall x r)
[PROOFSTEP]
filter_upwards [self_mem_nhdsWithin]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
⊢ ∀ (a : ℝ), a ∈ Ioi 0 → 1 = ↑↑μ (closedBall x a) / ↑↑μ (closedBall x a)
[PROOFSTEP]
intro r hr
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
r : ℝ
hr : r ∈ Ioi 0
⊢ 1 = ↑↑μ (closedBall x r) / ↑↑μ (closedBall x r)
[PROOFSTEP]
rw [div_eq_mul_inv, ENNReal.mul_inv_cancel]
[GOAL]
case h.h0
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
r : ℝ
hr : r ∈ Ioi 0
⊢ ↑↑μ (closedBall x r) ≠ 0
[PROOFSTEP]
exact (measure_closedBall_pos μ _ hr).ne'
[GOAL]
case h.ht
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
r : ℝ
hr : r ∈ Ioi 0
⊢ ↑↑μ (closedBall x r) ≠ ⊤
[PROOFSTEP]
exact measure_closedBall_lt_top.ne
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
A : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
⊢ Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
have B := ENNReal.Tendsto.sub A h (Or.inl ENNReal.one_ne_top)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
A : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
B :
Tendsto (fun a => ↑↑μ (closedBall x a) / ↑↑μ (closedBall x a) - ↑↑μ (s ∩ closedBall x a) / ↑↑μ (closedBall x a))
(𝓝[Ioi 0] 0) (𝓝 (1 - 1))
⊢ Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
simp only [tsub_self] at B
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
A : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
B :
Tendsto (fun a => ↑↑μ (closedBall x a) / ↑↑μ (closedBall x a) - ↑↑μ (s ∩ closedBall x a) / ↑↑μ (closedBall x a))
(𝓝[Ioi 0] 0) (𝓝 0)
⊢ Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
[PROOFSTEP]
apply B.congr' _
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
A : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
B :
Tendsto (fun a => ↑↑μ (closedBall x a) / ↑↑μ (closedBall x a) - ↑↑μ (s ∩ closedBall x a) / ↑↑μ (closedBall x a))
(𝓝[Ioi 0] 0) (𝓝 0)
⊢ (fun a =>
↑↑μ (closedBall x a) / ↑↑μ (closedBall x a) - ↑↑μ (s ∩ closedBall x a) / ↑↑μ (closedBall x a)) =ᶠ[𝓝[Ioi 0] 0]
fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)
[PROOFSTEP]
filter_upwards [self_mem_nhdsWithin]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
A : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
B :
Tendsto (fun a => ↑↑μ (closedBall x a) / ↑↑μ (closedBall x a) - ↑↑μ (s ∩ closedBall x a) / ↑↑μ (closedBall x a))
(𝓝[Ioi 0] 0) (𝓝 0)
⊢ ∀ (a : ℝ),
a ∈ Ioi 0 →
↑↑μ (closedBall x a) / ↑↑μ (closedBall x a) - ↑↑μ (s ∩ closedBall x a) / ↑↑μ (closedBall x a) =
↑↑μ (sᶜ ∩ closedBall x a) / ↑↑μ (closedBall x a)
[PROOFSTEP]
rintro r (rpos : 0 < r)
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
A : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
B :
Tendsto (fun a => ↑↑μ (closedBall x a) / ↑↑μ (closedBall x a) - ↑↑μ (s ∩ closedBall x a) / ↑↑μ (closedBall x a))
(𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
rpos : 0 < r
⊢ ↑↑μ (closedBall x r) / ↑↑μ (closedBall x r) - ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r) =
↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)
[PROOFSTEP]
convert I (closedBall x r) sᶜ (measure_closedBall_pos μ _ rpos).ne' measure_closedBall_lt_top.ne hs.compl
[GOAL]
case h.e'_2.h.e'_6.h.e'_5.h.e'_3.h.e'_3
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
A : Tendsto (fun r => ↑↑μ (closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
B :
Tendsto (fun a => ↑↑μ (closedBall x a) / ↑↑μ (closedBall x a) - ↑↑μ (s ∩ closedBall x a) / ↑↑μ (closedBall x a))
(𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
rpos : 0 < r
⊢ s = sᶜᶜ
[PROOFSTEP]
rw [compl_compl]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
L : Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
[PROOFSTEP]
have L' : Tendsto (fun r : ℝ => μ (sᶜ ∩ ({ x } + r • t)) / μ ({ x } + r • t)) (𝓝[>] 0) (𝓝 0) :=
tendsto_addHaar_inter_smul_zero_of_density_zero μ sᶜ x L t ht h''t
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
L : Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
L' : Tendsto (fun r => ↑↑μ (sᶜ ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
[PROOFSTEP]
have L'' : Tendsto (fun r : ℝ => μ ({ x } + r • t) / μ ({ x } + r • t)) (𝓝[>] 0) (𝓝 1) :=
by
apply tendsto_const_nhds.congr' _
filter_upwards [self_mem_nhdsWithin]
rintro r (rpos : 0 < r)
rw [addHaar_singleton_add_smul_div_singleton_add_smul μ rpos.ne', ENNReal.div_self h't h''t]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
L : Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
L' : Tendsto (fun r => ↑↑μ (sᶜ ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ Tendsto (fun r => ↑↑μ ({x} + r • t) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
[PROOFSTEP]
apply tendsto_const_nhds.congr' _
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
L : Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
L' : Tendsto (fun r => ↑↑μ (sᶜ ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ (fun x => 1) =ᶠ[𝓝[Ioi 0] 0] fun r => ↑↑μ ({x} + r • t) / ↑↑μ ({x} + r • t)
[PROOFSTEP]
filter_upwards [self_mem_nhdsWithin]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
L : Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
L' : Tendsto (fun r => ↑↑μ (sᶜ ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
⊢ ∀ (a : ℝ), a ∈ Ioi 0 → 1 = ↑↑μ ({x} + a • t) / ↑↑μ ({x} + a • t)
[PROOFSTEP]
rintro r (rpos : 0 < r)
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
L : Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
L' : Tendsto (fun r => ↑↑μ (sᶜ ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
r : ℝ
rpos : 0 < r
⊢ 1 = ↑↑μ ({x} + r • t) / ↑↑μ ({x} + r • t)
[PROOFSTEP]
rw [addHaar_singleton_add_smul_div_singleton_add_smul μ rpos.ne', ENNReal.div_self h't h''t]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
L : Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
L' : Tendsto (fun r => ↑↑μ (sᶜ ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
L'' : Tendsto (fun r => ↑↑μ ({x} + r • t) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
[PROOFSTEP]
have := ENNReal.Tendsto.sub L'' L' (Or.inl ENNReal.one_ne_top)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
L : Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
L' : Tendsto (fun r => ↑↑μ (sᶜ ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
L'' : Tendsto (fun r => ↑↑μ ({x} + r • t) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
this :
Tendsto (fun a => ↑↑μ ({x} + a • t) / ↑↑μ ({x} + a • t) - ↑↑μ (sᶜ ∩ ({x} + a • t)) / ↑↑μ ({x} + a • t)) (𝓝[Ioi 0] 0)
(𝓝 (1 - 0))
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
[PROOFSTEP]
simp only [tsub_zero] at this
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
L : Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
L' : Tendsto (fun r => ↑↑μ (sᶜ ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
L'' : Tendsto (fun r => ↑↑μ ({x} + r • t) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
this :
Tendsto (fun a => ↑↑μ ({x} + a • t) / ↑↑μ ({x} + a • t) - ↑↑μ (sᶜ ∩ ({x} + a • t)) / ↑↑μ ({x} + a • t)) (𝓝[Ioi 0] 0)
(𝓝 1)
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
[PROOFSTEP]
apply this.congr' _
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
L : Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
L' : Tendsto (fun r => ↑↑μ (sᶜ ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
L'' : Tendsto (fun r => ↑↑μ ({x} + r • t) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
this :
Tendsto (fun a => ↑↑μ ({x} + a • t) / ↑↑μ ({x} + a • t) - ↑↑μ (sᶜ ∩ ({x} + a • t)) / ↑↑μ ({x} + a • t)) (𝓝[Ioi 0] 0)
(𝓝 1)
⊢ (fun a => ↑↑μ ({x} + a • t) / ↑↑μ ({x} + a • t) - ↑↑μ (sᶜ ∩ ({x} + a • t)) / ↑↑μ ({x} + a • t)) =ᶠ[𝓝[Ioi 0] 0]
fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)
[PROOFSTEP]
filter_upwards [self_mem_nhdsWithin]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
L : Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
L' : Tendsto (fun r => ↑↑μ (sᶜ ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
L'' : Tendsto (fun r => ↑↑μ ({x} + r • t) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
this :
Tendsto (fun a => ↑↑μ ({x} + a • t) / ↑↑μ ({x} + a • t) - ↑↑μ (sᶜ ∩ ({x} + a • t)) / ↑↑μ ({x} + a • t)) (𝓝[Ioi 0] 0)
(𝓝 1)
⊢ ∀ (a : ℝ),
a ∈ Ioi 0 →
↑↑μ ({x} + a • t) / ↑↑μ ({x} + a • t) - ↑↑μ (sᶜ ∩ ({x} + a • t)) / ↑↑μ ({x} + a • t) =
↑↑μ (s ∩ ({x} + a • t)) / ↑↑μ ({x} + a • t)
[PROOFSTEP]
rintro r (rpos : 0 < r)
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
L : Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
L' : Tendsto (fun r => ↑↑μ (sᶜ ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
L'' : Tendsto (fun r => ↑↑μ ({x} + r • t) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
this :
Tendsto (fun a => ↑↑μ ({x} + a • t) / ↑↑μ ({x} + a • t) - ↑↑μ (sᶜ ∩ ({x} + a • t)) / ↑↑μ ({x} + a • t)) (𝓝[Ioi 0] 0)
(𝓝 1)
r : ℝ
rpos : 0 < r
⊢ ↑↑μ ({x} + r • t) / ↑↑μ ({x} + r • t) - ↑↑μ (sᶜ ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t) =
↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)
[PROOFSTEP]
refine' I ({ x } + r • t) s _ _ hs
[GOAL]
case h.refine'_1
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
L : Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
L' : Tendsto (fun r => ↑↑μ (sᶜ ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
L'' : Tendsto (fun r => ↑↑μ ({x} + r • t) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
this :
Tendsto (fun a => ↑↑μ ({x} + a • t) / ↑↑μ ({x} + a • t) - ↑↑μ (sᶜ ∩ ({x} + a • t)) / ↑↑μ ({x} + a • t)) (𝓝[Ioi 0] 0)
(𝓝 1)
r : ℝ
rpos : 0 < r
⊢ ↑↑μ ({x} + r • t) ≠ 0
[PROOFSTEP]
simp only [h't, abs_of_nonneg rpos.le, pow_pos rpos, addHaar_smul, image_add_left, ENNReal.ofReal_eq_zero, not_le,
or_false_iff, Ne.def, measure_preimage_add, abs_pow, singleton_add, mul_eq_zero]
[GOAL]
case h.refine'_2
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
hs : MeasurableSet s
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
I :
∀ (u v : Set E), ↑↑μ u ≠ 0 → ↑↑μ u ≠ ⊤ → MeasurableSet v → ↑↑μ u / ↑↑μ u - ↑↑μ (vᶜ ∩ u) / ↑↑μ u = ↑↑μ (v ∩ u) / ↑↑μ u
L : Tendsto (fun r => ↑↑μ (sᶜ ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 0)
L' : Tendsto (fun r => ↑↑μ (sᶜ ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 0)
L'' : Tendsto (fun r => ↑↑μ ({x} + r • t) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
this :
Tendsto (fun a => ↑↑μ ({x} + a • t) / ↑↑μ ({x} + a • t) - ↑↑μ (sᶜ ∩ ({x} + a • t)) / ↑↑μ ({x} + a • t)) (𝓝[Ioi 0] 0)
(𝓝 1)
r : ℝ
rpos : 0 < r
⊢ ↑↑μ ({x} + r • t) ≠ ⊤
[PROOFSTEP]
simp [h''t, ENNReal.ofReal_ne_top, addHaar_smul, image_add_left, ENNReal.mul_eq_top, Ne.def, not_false_iff,
measure_preimage_add, singleton_add, and_false_iff, false_and_iff, or_self_iff]
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
[PROOFSTEP]
have : Tendsto (fun r : ℝ => μ (toMeasurable μ s ∩ ({ x } + r • t)) / μ ({ x } + r • t)) (𝓝[>] 0) (𝓝 1) :=
by
apply tendsto_addHaar_inter_smul_one_of_density_one_aux μ _ (measurableSet_toMeasurable _ _) _ _ t ht h't h''t
apply tendsto_of_tendsto_of_tendsto_of_le_of_le' h tendsto_const_nhds
· refine' eventually_of_forall fun r => mul_le_mul_right' _ _
exact measure_mono (inter_subset_inter_left _ (subset_toMeasurable _ _))
· filter_upwards [self_mem_nhdsWithin]
rintro r -
apply ENNReal.div_le_of_le_mul
rw [one_mul]
exact measure_mono (inter_subset_right _ _)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
⊢ Tendsto (fun r => ↑↑μ (toMeasurable μ s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
[PROOFSTEP]
apply tendsto_addHaar_inter_smul_one_of_density_one_aux μ _ (measurableSet_toMeasurable _ _) _ _ t ht h't h''t
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
⊢ Tendsto (fun r => ↑↑μ (toMeasurable μ s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
[PROOFSTEP]
apply tendsto_of_tendsto_of_tendsto_of_le_of_le' h tendsto_const_nhds
[GOAL]
case hgf
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
⊢ ∀ᶠ (b : ℝ) in 𝓝[Ioi 0] 0,
↑↑μ (s ∩ closedBall x b) / ↑↑μ (closedBall x b) ≤ ↑↑μ (toMeasurable μ s ∩ closedBall x b) / ↑↑μ (closedBall x b)
[PROOFSTEP]
refine' eventually_of_forall fun r => mul_le_mul_right' _ _
[GOAL]
case hgf
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
r : ℝ
⊢ ↑↑μ (s ∩ closedBall x r) ≤ ↑↑μ (toMeasurable μ s ∩ closedBall x r)
[PROOFSTEP]
exact measure_mono (inter_subset_inter_left _ (subset_toMeasurable _ _))
[GOAL]
case hfh
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
⊢ ∀ᶠ (b : ℝ) in 𝓝[Ioi 0] 0, ↑↑μ (toMeasurable μ s ∩ closedBall x b) / ↑↑μ (closedBall x b) ≤ 1
[PROOFSTEP]
filter_upwards [self_mem_nhdsWithin]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
⊢ ∀ (a : ℝ), a ∈ Ioi 0 → ↑↑μ (toMeasurable μ s ∩ closedBall x a) / ↑↑μ (closedBall x a) ≤ 1
[PROOFSTEP]
rintro r -
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
r : ℝ
⊢ ↑↑μ (toMeasurable μ s ∩ closedBall x r) / ↑↑μ (closedBall x r) ≤ 1
[PROOFSTEP]
apply ENNReal.div_le_of_le_mul
[GOAL]
case h.h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
r : ℝ
⊢ ↑↑μ (toMeasurable μ s ∩ closedBall x r) ≤ 1 * ↑↑μ (closedBall x r)
[PROOFSTEP]
rw [one_mul]
[GOAL]
case h.h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
r : ℝ
⊢ ↑↑μ (toMeasurable μ s ∩ closedBall x r) ≤ ↑↑μ (closedBall x r)
[PROOFSTEP]
exact measure_mono (inter_subset_right _ _)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
this : Tendsto (fun r => ↑↑μ (toMeasurable μ s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
⊢ Tendsto (fun r => ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
[PROOFSTEP]
refine this.congr fun r => ?_
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
this : Tendsto (fun r => ↑↑μ (toMeasurable μ s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
r : ℝ
⊢ ↑↑μ (toMeasurable μ s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t) = ↑↑μ (s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)
[PROOFSTEP]
congr 1
[GOAL]
case e_a
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
this : Tendsto (fun r => ↑↑μ (toMeasurable μ s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
r : ℝ
⊢ ↑↑μ (toMeasurable μ s ∩ ({x} + r • t)) = ↑↑μ (s ∩ ({x} + r • t))
[PROOFSTEP]
apply measure_toMeasurable_inter_of_sigmaFinite
[GOAL]
case e_a.hs
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
this : Tendsto (fun r => ↑↑μ (toMeasurable μ s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
r : ℝ
⊢ MeasurableSet ({x} + r • t)
[PROOFSTEP]
simp only [image_add_left, singleton_add]
[GOAL]
case e_a.hs
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
h''t : ↑↑μ t ≠ ⊤
this : Tendsto (fun r => ↑↑μ (toMeasurable μ s ∩ ({x} + r • t)) / ↑↑μ ({x} + r • t)) (𝓝[Ioi 0] 0) (𝓝 1)
r : ℝ
⊢ MeasurableSet ((fun x_1 => -x + x_1) ⁻¹' (r • t))
[PROOFSTEP]
apply (continuous_add_left (-x)).measurable (ht.const_smul₀ r)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
⊢ ∀ᶠ (r : ℝ) in 𝓝[Ioi 0] 0, Set.Nonempty (s ∩ ({x} + r • t))
[PROOFSTEP]
obtain ⟨t', t'_meas, t't, t'pos, t'top⟩ : ∃ t', MeasurableSet t' ∧ t' ⊆ t ∧ 0 < μ t' ∧ μ t' < ⊤ :=
exists_subset_measure_lt_top ht h't.bot_lt
[GOAL]
case intro.intro.intro.intro
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
t' : Set E
t'_meas : MeasurableSet t'
t't : t' ⊆ t
t'pos : 0 < ↑↑μ t'
t'top : ↑↑μ t' < ⊤
⊢ ∀ᶠ (r : ℝ) in 𝓝[Ioi 0] 0, Set.Nonempty (s ∩ ({x} + r • t))
[PROOFSTEP]
filter_upwards [(tendsto_order.1
(tendsto_addHaar_inter_smul_one_of_density_one μ s x h t' t'_meas t'pos.ne' t'top.ne)).1
0 zero_lt_one]
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
t' : Set E
t'_meas : MeasurableSet t'
t't : t' ⊆ t
t'pos : 0 < ↑↑μ t'
t'top : ↑↑μ t' < ⊤
⊢ ∀ (a : ℝ), 0 < ↑↑μ (s ∩ ({x} + a • t')) / ↑↑μ ({x} + a • t') → Set.Nonempty (s ∩ ({x} + a • t))
[PROOFSTEP]
intro r hr
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
t' : Set E
t'_meas : MeasurableSet t'
t't : t' ⊆ t
t'pos : 0 < ↑↑μ t'
t'top : ↑↑μ t' < ⊤
r : ℝ
hr : 0 < ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • t')
⊢ Set.Nonempty (s ∩ ({x} + r • t))
[PROOFSTEP]
have : μ (s ∩ ({ x } + r • t')) ≠ 0 := fun h' => by simp only [ENNReal.not_lt_zero, ENNReal.zero_div, h'] at hr
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
t' : Set E
t'_meas : MeasurableSet t'
t't : t' ⊆ t
t'pos : 0 < ↑↑μ t'
t'top : ↑↑μ t' < ⊤
r : ℝ
hr : 0 < ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • t')
h' : ↑↑μ (s ∩ ({x} + r • t')) = 0
⊢ False
[PROOFSTEP]
simp only [ENNReal.not_lt_zero, ENNReal.zero_div, h'] at hr
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
t' : Set E
t'_meas : MeasurableSet t'
t't : t' ⊆ t
t'pos : 0 < ↑↑μ t'
t'top : ↑↑μ t' < ⊤
r : ℝ
hr : 0 < ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • t')
this : ↑↑μ (s ∩ ({x} + r • t')) ≠ 0
⊢ Set.Nonempty (s ∩ ({x} + r • t))
[PROOFSTEP]
have : (s ∩ ({ x } + r • t')).Nonempty := nonempty_of_measure_ne_zero this
[GOAL]
case h
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
t' : Set E
t'_meas : MeasurableSet t'
t't : t' ⊆ t
t'pos : 0 < ↑↑μ t'
t'top : ↑↑μ t' < ⊤
r : ℝ
hr : 0 < ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • t')
this✝ : ↑↑μ (s ∩ ({x} + r • t')) ≠ 0
this : Set.Nonempty (s ∩ ({x} + r • t'))
⊢ Set.Nonempty (s ∩ ({x} + r • t))
[PROOFSTEP]
apply this.mono (inter_subset_inter Subset.rfl _)
[GOAL]
E : Type u_1
inst✝⁸ : NormedAddCommGroup E
inst✝⁷ : NormedSpace ℝ E
inst✝⁶ : MeasurableSpace E
inst✝⁵ : BorelSpace E
inst✝⁴ : FiniteDimensional ℝ E
μ : Measure E
inst✝³ : IsAddHaarMeasure μ
F : Type u_2
inst✝² : NormedAddCommGroup F
inst✝¹ : NormedSpace ℝ F
inst✝ : CompleteSpace F
s✝ s : Set E
x : E
h : Tendsto (fun r => ↑↑μ (s ∩ closedBall x r) / ↑↑μ (closedBall x r)) (𝓝[Ioi 0] 0) (𝓝 1)
t : Set E
ht : MeasurableSet t
h't : ↑↑μ t ≠ 0
t' : Set E
t'_meas : MeasurableSet t'
t't : t' ⊆ t
t'pos : 0 < ↑↑μ t'
t'top : ↑↑μ t' < ⊤
r : ℝ
hr : 0 < ↑↑μ (s ∩ ({x} + r • t')) / ↑↑μ ({x} + r • t')
this✝ : ↑↑μ (s ∩ ({x} + r • t')) ≠ 0
this : Set.Nonempty (s ∩ ({x} + r • t'))
⊢ {x} + r • t' ⊆ {x} + r • t
[PROOFSTEP]
exact add_subset_add Subset.rfl (smul_set_mono t't)
|
module LLVM.AST
|
#!/usr/bin/python2.7
# -*- coding:utf-8 -*-
# Author: NetworkRanger
# Date: 2018/12/14 下午11:02
# 8.4 再训练已有的CNN模型
# 1. 导入必要的编程库,包括下载、解压和保存CIFAR-10图片数据的编程库
import os
import tarfile
import _pickle as cPickle
import numpy as np
import urllib.request
import scipy.misc
# 2. 定义CIFAR-10图片数据链接,创建存储数据的临时文件夹,并声明图片的十个分类
cifar_link = 'https://www.cs.toronto.edu/~kirz/cifar-10-python.tar.gz'
data_dir = 'temp'
if not os.path.isdir(data_dir):
os.makedirs(data_dir)
objects = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck']
# 3. 下载CIFAR-10.tar数据文件,并解压压缩文件
target_file = os.path.join(data_dir, 'cifar-10-python.tar.gz')
if not os.path.isfile(target_file):
print('CIFAR-10 file not found. Downloading CIFAR data (Size = 163MB)')
print('This may take a few minutes, please wait.')
filename, headers = urllib.request.urlretrieve(cifar_link, target_file)
# Extraact into memory
tar = tarfile.open(target_file)
tar.extractall(path=data_dir)
tar.close()
# 4. 创建训练所需的文件夹结构。临时目录下有两个文件夹train_dir和validation_dir。每个文件夹下有10个子文件夹,分别存储10个目标分类
# Create train images folders
train_folder = 'train_dir'
if not os.path.isdir(os.path.join(data_dir, train_folder)):
for i in range(10):
folder = os.path.join(data_dir, train_folder, objects[i])
os.makedirs(folder)
# Create test image folders
test_folder = 'validation_dir'
if not os.path.isdir(os.path.join(data_dir, test_folder)):
for i in range(10):
folder = os.path.join(data_dir, test_folder, objects[i])
os.makedirs(folder)
# 5. 为了保存图片,我们将创建函数从内存中加载图片并存入文件夹
def load_batch_from_file(file):
file_conn = open(file, 'rb')
image_dictionary = cPickle.load(file_conn, encoding='latin1')
file_conn.close()
return (image_dictionary)
# 6. 在上一步的文件夹中,为每个目标分类保存一个文件
def save_imaeg_from_dict(image_dict, foler='data_dir'):
for ix,label in enumerate(image_dict['labels']):
folder_path = os.path.join(data_dir, folder, objects[label])
filename = image_dict['filename'][ix]
# Transform image data
image_array = image_dict['data'][ix]
image_array.resize([3, 32, 32])
# Save image
output_location = os.path.join(folder_path, filename)
scipy.misc.imsave(output_location, image_array.transpose())
# 7. 对于上一步的函数,遍历下载数据文件,并把每个图片保存到正确的位置
data_location = os.path.join(data_dir, 'cifar-10-batches-py')
train_names = ['data_batch_'+str(x) for x in range(1,6)]
test_names = ['test_batch']
# Sort train images
for file in train_names:
print('Saving images from file: {}'.format(file))
file_location = os.path.join(data_dir, 'cifar-10-batches-py', file)
image_dict = load_batch_from_file(file_location)
save_imaeg_from_dict(image_dict, folder=train_folder)
# Sort test images
for file in test_names:
print('Saving images from file: {}'.format(file))
file_location = os.path.join(data_dir, 'cifar-10-batches-py', file)
image_dict = load_batch_from_file(file_location)
save_imaeg_from_dict(image_dict, folder=test_folder)
# 8. Python脚本最后部分是创建标注文件。该文件用标注(而不是数值索引)自解释输出结果
cifar_labels_file = os.path.join(data_dir, 'cifar10_labels.txt')
print('Writing labels file, {}'.format(cifar_labels_file))
with open(cifar_labels_file, 'w') as labels_file:
for item in objects:
labels_file.write('{}\n'.format(item))
# 9. 上面的脚本运行之后,下载图片数据集并排序归类。接着按TensorFlow官方示例操作,先复制例子源码
# git clone https://github.com/tensorflow/models/tree/master/inception/inception
# 10. 为了重用已训练好的模型,我们下载神经网络权重并应用于新神经网络模型
"""
me@computer: ~$ curl -O http://download.tensorflow.org/models/image/imagenet/inception-v3-2016-03-01.tar.gz
me@computer: ~$ tar xzf inception-v3-2016-03-1.tar.gz
"""
# 11. 准备好图片文件,我们将其转为TFRecords对象
"""
me@computer: ~$ python3 data/build_image_data.py
---train_directory="temp/train_dir/"
--validation_directory="temp/validation_dir"
--output_directory="temp" --labels_file="temp/cifar10_labels.txt"
"""
# 12. 使用bazel模块训练算法模型,设置fine_tune参数为true。该脚本每迭代10次输出损失函数。我们可以随机终止进程,因为模型输出结果都保存于temp/training_results文件夹。我们能从该文件夹加载模型数据进行模型评估
"""
me@computer: ~$ bazel-bin/inception/flowers_train
--train_dir="temp/training_results" --data-dir="temp/data_dir"
--pretrained_model_checkpoint_path="model.ckpt-157585"
--fine_tune=True --initial_learning_rate=0.001
--input_queue_memory_factor=1
"""
# 13. 训练输出结果如下
"""
2016-09-18 12:16:32.563577: step 1290, loss = 2.02 (1.2 examples/sec; 26.965 sec/batch)
2016-09-18 12:25:42.316540: step 1300, loss = 2.01 (1.2 exapmles/sec; 26.357 sec/batch)
"""
|
myTestRule {
#Turn on audit trail in iRODS/server/icat/src/icatMidLevelRoutines.c
#Input parameters are:
# Keyword to search for within audit comment field
# read
# delete
# guest
# Buffer to hold result
#Output parameter is:
# Status
msiGetAuditTrailInfoByKeywords(*Keyword,*Buf,*Status);
writeBytesBuf("stdout",*Buf);
}
INPUT *Keyword="%guest%"
OUTPUT ruleExecOut
|
import os
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np
class DataLog:
"""
Class to collect data from simulation and store it somewhere
"""
def __init__(self):
self.sim = None
self.f = None
self.ToFile = False
self.ToHeatMap = False
now = str(datetime.now().time())
self.folder = "My Sim "+now
def set(self,sim,path,ToFile= False,ToHeatMap= False):
"""
Set the simulation argument
Parameters
----------
sim : Simulator
Simulator argument
path : str
Path where to save the log file
"""
self.sim = sim
self.f = open(path,"w")
self.ToFile = ToFile
self.ToHeatMap = ToHeatMap
def storeToFile(self,label,data):
"""
Store the log to the file
"""
i = 0
for d in data[0]:
self.f.write(label+":"+str(i)+":"+str(d)+"\n")
i = i + 1
def storeToHeatMap(self,data,t):
if not os.path.exists(self.folder):
os.makedirs(self.folder)
i = 0
for d in data[0]:
if not os.path.exists(self.folder+"/"+str(i)):
os.makedirs(self.folder+"/"+str(i))
plt.matshow(np.reshape(d,(28,28)),cmap="Reds")
plt.title(str(i)+str(t))
plt.savefig(self.folder+"/"+str(i)+"/"+str(i)+":"+str(i)+str(t)+".png")
plt.cla()
i = i+1
def closeLog(self):
"""
Close log file
"""
self.f.close()
def __call__(self, t):
if self.sim is not None:
assert len(self.sim.model.probes) != 0 , "No Probes to store"
for probe in self.sim.model.probes:
if len(self.sim._sim_data[probe]) != 0:
self.sim._sim_data[probe] = [self.sim._sim_data[probe][-1]]
if self.ToFile:
self.storeToFile(str(t)+probe.label,self.sim._sim_data[probe])
if self.ToHeatMap:
self.storeToHeatMap(self.sim._sim_data[probe],t) |
# Salsa20 specific tests
# Copyright (C): Jaka Smrekar (vinctux) <[email protected]>, 2016
using Krypto
using Base.Test
println("SALSA20 TESTS STARTED...")
# Test values - 1024 octets (random, 0x00, 0xFF, flip)
T = [[csrand(0o1:0o255) for i in 1:256],
[0o0 for i in 1:256],
[0o377 for i in 1:256],
[i % 2 == 0 ? 0o0 : 0o1 for i in 1:256],
Array{UInt8, 1}("This is Salsa20-Is this Salsa20?")]
IV = csrand(32)
for i in 1:length(T)
for j in 1:length(T)
println("Running encryption test #$(i) with key #$(j)... ")
@time @test decrypt(Salsa20, encrypt(Salsa20, T[i], IV, T[j]), IV, T[j]) == T[i]
end
end
println("ALL SALSA20 TESTS PASSED.")
|
block data
include "blk17.h"
DATA ICOR/1,-1,0,0,1,1,2,3,3,4,4,5/
END
|
% By Roger Aarenstrup, [email protected]
% 2006-08-18
%
% This is a state-space DC motor model of a
% Maxon RE25 10 Watt, precious metal brushes, 118743
%
% This model also have a weak connection to a load.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The full dc motor model %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Vin is the input voltage to the motor
% i is the motor current
% th_m is the rotor angle, theta
% dth_m is the rotor angular velocity sometimes called omega
% th_l is the load angle
% dth_l is the load angular velocity
% Controller Sample Time
Ts = 100e-6;
% PARAMETERS DC MOTOR
Rm = 2.06; % Motor resistance (ohm)
Lm = 0.000238; % motor inductance (Henrys)
Kb = 1/((406*2*pi)/60); % Back EMF constant (Volt-sec/Rad)
Kt = 0.0235; % Torque constand (Nm/A)
Jm = 1.07e-6; % Rotor inertia (Kg m^2)
bm = 12e-7; % MEchanical damping (linear model of
% friction: bm * dth)
% PARAMETERS LOAD
Jl = 10.07e-6; % Load inertia (10 times the rotor)
bl = 12e-6; % Load damping (friction)
Ks = 100; % Spring constant for connection rotor/load
b = 0.0001; % Spring damping for connection rotor/load
% SYSTEM MATRICES
%
% States: [i dth_m th_m dth_l th_l]'
% Input: Vin the motor voltage
% Outputs: same as states
%
Afull = [-Rm/Lm -Kb/Lm 0 0 0;
Kt/Jm -(bm+b)/Jm -Ks/Jm b/Jm Ks/Jm;
0 1 0 0 0;
0 b/Jl Ks/Jl -(b+bl)/Jl -Ks/Jl;
0 0 0 1 0];
Bfull = [1/Lm 0 0 0 0]';
Cfull = [0 1 0 0 0;
0 0 1 0 0;
0 0 0 1 0;
0 0 0 0 1];
Dfull = [0 0 0 0]';
sys_full = ss(Afull, Bfull, Cfull, Dfull);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The reduced dc motor model for current control %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SYSTEM MATRICES
%
% States: [dth_m th_m dth_l th_l]'
% Input: I The current to the dc motor
% Outputs: same as states
%
Ared = [ -(bm+b)/Jm -Ks/Jm b/Jm Ks/Jm;
1 0 0 0;
b/Jl Ks/Jl -(b+bl)/Jl -Ks/Jl;
0 0 1 0];
Bred = [Kt/Jm 0 0 0]';
Cred = eye(4);
Dred = [0 0 0 0]';
sys_red = ss(Ared, Bred, Cred, Dred);
% Discrete version of the model (as seen from the controller)
sys_red_d = c2d(sys_red, Ts, 'zoh');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% State-space controller design attempt 1 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The discrete poles of the closed loop system
dpole1 = exp(-2*pi*Ts*[20 22 24 26]);
% Calculate the control parameters
L1 = place(sys_red_d.a, sys_red_d.b, dpole1);
% Keep the static gain of the closed loop system to 1
F=feedback(sys_red_d, L1); % The closed loop system, F.
Kstatic = freqresp(F, 0); % Get the static gain of F.
Kstat = 1/Kstatic(4); % It is the fourth output (load position)
% The above commands requires toolboxes, incase you don't have them
% you can simulate the system with a unit step is see the output static
% gain. Kstat will be the inverse of that.
% to verify the pole placement
%pzmap(F);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% State-space controller design attempt 2 - Integrator %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The discrete poles of the closed loop system
dpole2 = exp(-2*pi*Ts*[20 22 24 26 5]);
% We only consider one output here
Cred_one = [0 1 0 0];
% Calculate the control parameters
Aint = [sys_red_d.a [0 0 0 0]';
-Cred_one 1];
Bint= [sys_red_d.b' 0]';
Cint = [Cred_one 0];
Dint = [0]';
sys_int_d2 = ss(Aint, Bint, Cint, Dint, Ts);
% Controllability VS Observability analysis
%ob = obsv(sys_int_d2.a, sys_int_d2.c);
%cr = ctrb(sys_int_d2.a, sys_int_d2.b);
%rank(ob)
%rank(cr)
[L2, a, m] = place(sys_int_d2.a, sys_int_d2.b, dpole2);
% Feed Forward gain
Kff = L2(5)/(dpole2(5) - 1);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% State-space controller design attempt 3 - Observer %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% These should be about twice as fast as the state feedback
% for the controller.
dpole3 = exp(-2*pi*Ts*[1400 1450 1500 1550]);
%dpole3 = [-0.3 -0.33 -0.35 -0.37];
% Recalculate the reduced model with one ouput
Cred2 = [0 1 0 0];
Dred2 = 0;
sys_red2 = ss(Ared, Bred, Cred2, Dred2);
% Discrete version of the model (as seen from the controller)
sys_red_d2 = c2d(sys_red2, Ts, 'zoh');
set(sys_red_d2, 'inputname', {'Um'}, ...
'outputname', {'Enc_out'});
% Calculate the observer state feedback
K = place(sys_red_d2.a', sys_red_d2.c', dpole3);
% Put the observer together
Aobs = [sys_red_d2.a-K'*sys_red_d2.c];
Bobs = [sys_red_d2.b K'];
Cobs = eye(4);
Dobs = [0 0 0 0; 0 0 0 0]';
observer = ss(Aobs, Bobs, Cobs, Dobs, Ts, 'inputname', {'Ue', 'Enc_in'}, ...
'outputname', {'dth_m', 'th_m', 'dth_l', 'th_l'});
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% State-space controller design attempt 4 - The Servo Case %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Kinv = (Jl+Jm)/Kt;
dpole4 = exp(-2*pi*Ts*[200 204 220 224 300]);
[L3, a, m] = place(sys_int_d2.a, sys_int_d2.b, dpole4);
|
IWTYAL 100: Language learners around the world reveal their best tips!
This is episode 100 of the podcast!
In this episode we hear from you – the listeners.
I asked you to tell me the single biggest lesson about language learning you've learnt from listening to 100 episodes of the podcast.
I was struck by the diversity of people around the world who got in touch – everyone learning different languages, in different countries.
It was truly inspiring, and it reminded me how we are all striving to improve our lives by learning languages, and are making the world a better place in the process.
I hope you enjoy this special episode!
Please leave me a comment below with your favourite message of all!
Also, please take a second to share this podcast episode on Facebook, Twitter, or with a friend who's learning a language.
They'll draw motivation from all the others around the world learning languages, and find a new lease of life in their own learning! |
[STATEMENT]
theorem AA31: "\<turnstile> \<diamond>\<langle>\<circle>F\<rangle>_v \<longrightarrow> \<diamond>F"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<turnstile> \<diamond>\<langle>\<circle>F\<rangle>_v \<longrightarrow> \<diamond>F
[PROOF STEP]
using pref_imp_trans[OF AA21 E29]
[PROOF STATE]
proof (prove)
using this:
|~ \<diamond>\<langle>\<circle>?F1\<rangle>_?v2 \<longrightarrow> \<diamond>?F1
goal (1 subgoal):
1. \<turnstile> \<diamond>\<langle>\<circle>F\<rangle>_v \<longrightarrow> \<diamond>F
[PROOF STEP]
by auto |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Invert bispectrum components
@author: matteo
"""
import numpy as np
from ase import Atom
from inv.descriptors import Bispectrum
def Inversion(start, target, rcutfac, rfac0, twojmax, N, gamma, eta, nu):
'''
Updates the starting configuration in order to reproduce the descriptors of the target structure.
Parameters
----------
start : Atoms
Starting configuration
target : Atoms
Target structure only its bispectrum components are considered in the
inversion process.
rcutfac : float
Scale factor applied to all cutof radii which are set to 1.0 ang.
rfac0 : float
distance to angle conversion (0 < rcutfac < 1).
twojmax : int
Angular momentum limit for bispectrum components.
N : int, optional
Number of iterations of the invertion algorithm. The default is 100.
gamma : float, optional
Learning rate of the gradient descent. The default is 0.0000008.
eta : float, optional
Coupling constant of the loss with the noise term. The default is 5e-2.
nu : float, optional
Damping constant of the noise term. The default is 1e-4.
Returns
-------
Atoms
Atoms objects containing the configuration resulting
from the inversion process.
loss : list of float
Loss value at each step of the inversion process
'''
# Compute target descriptors
target_b, target_bd = Bispectrum(target.data['structures'],
[Atom(_).number for _ in sorted(set([Atom(t).symbol for t in target.data['types']]))],
rcutfac,
rfac0,
twojmax
)
###
n_atoms = len(start.data['structures'])
n_b = int((twojmax/2+1)*(twojmax/2+1.5)*(twojmax/2+2)/3) # Wood, Thopson J., Chem. Phys. 148, 241721 (2018) tab.1
sum_bt = [np.zeros(n_b) for _ in range(len(target.data['all_types']))]
for i in range(n_atoms):
sum_bt[target.data['all_types'].index(target.data['types'][i])] += target_b[i]
loss = []
grad_loss = []
for step in range(N):
prototype_b, prototype_bd = Bispectrum(start.data['structures'],
[Atom(_).number for _ in sorted(set([Atom(t).symbol for t in start.data['types']]))],
rcutfac,
rfac0,
twojmax
)
loss.append(0.0)
grad_loss = [[0.0, 0.0, 0.0] for _ in range(n_atoms)]
sum_b = [np.zeros(n_b) for _ in range(len(start.data['all_types']))]
for i in range(n_atoms):
sum_b[start.data['all_types'].index(start.data['types'][i])] += prototype_b[i]
for t in range(len(start.data['all_types'])):
loss[step] += np.dot(sum_bt[t]-sum_b[t], sum_bt[t]-sum_b[t])
for i in range(n_atoms):
for j in range(len(start.data['all_types'])):
for k in range(3):
grad_loss[i][k] += -2*np.dot(sum_bt[j]-sum_b[j], prototype_bd[i][j][k])
start.data['structures'].positions[i] = np.array(start.data['structures'].positions[i]) + gamma*np.array(grad_loss[i]) + eta*np.exp(-nu*step)*np.random.uniform()
return start.data['structures'], loss |
# This file contains some aliases and generic methods to use neural networks.
export logψ, ∇logψ, ∇logψ!, logψ_and_∇logψ, logψ_and_∇logψ!, grad_cache
"""
grad_cache(net::N) -> tuple
Creates a tuple holding all derivatives of the network N.
"""
grad_cache(net::NeuralNetwork) = begin
is_analytic(net) && return RealDerivative(net)
return WirtingerDerivative(net)
end
# Define various aliases used a bit everywhere in networks and when testing
"""
logψ(net, σ) -> Number
Evaluates the neural network `net` for the given input `σ`.
This will return the value ⟨σ|ψ⟩ if the network represents a pure state (a ket)
or ⟨σᵣ|ρ̂|σᵪ⟩, where σ=(σᵣ,σᵪ), if the network encodes a mixed state.
This is equivalent to `net(σ)`.
The numerical type of the output is `out_type(net)`.
If `net isa CachedNet` then the computation will be performed efficiently
with minimal allocations.
"""
@inline logψ(net::NeuralNetwork, σ) = net(σ)
@inline log_prob_ψ(net, σ...) = 2.0*real(net(σ...))
@inline ∇logψ(args...) = logψ_and_∇logψ(args...)[2]
@inline ∇logψ!(args...) = logψ_and_∇logψ!(args...)[2]
"""
logψ_and_∇logψ(net, σ)
Evaluates the neural network `net` for the given input `σ` and returns both the
value and it's gradient w.r.t. to the nework's parameters.
!! The gradient will be allocated. Don't use this in a hot loop and prefer the
in-place version `logψ_and_∇logψ!`. The gradient is always allocated by calling
`grad_cache(net)`.
!! If `net isa CachedNet` and the gradient has been hand-coded, the hand-coded
version will be used, otherwise `Zygote` will be used to generate the
gradient with AD. This case is much slower and incurs a long precompilation
time.
See also: `logψ`, `logψ_and_∇logψ!`
"""
function logψ_and_∇logψ(net::NeuralNetwork, σ::Vararg{N,V})where {N,V}
der = grad_cache(net)
y, der = logψ_and_∇logψ!(der, net, σ)
return y, der
end
# Autodiff version of the gradient: if you are hitting this, expect
# bad performance. Maybe you should hand-code the gradient of your model?
function logψ_and_∇logψ!(der, net::NeuralNetwork, σ)
σ = config(σ)
# Zygote's autodiff: generate the pullback
y, back = forward(net -> net(σ...), net)
# This computes the gradient, which is the conjugate of the derivative
_der = back(Int8(1))[1]
for key=keys(_der)
conj!(_der[key])
copyto!(der[key], _der[key])
end
return y, der
end
# Common Operations on networks that should always be defined
# If you hit this section it probably means that you forgot to define one
# of those functions on the type of your neural network.
"""
input_type(net) -> Type
Returns the numerical `eltype` of the input for efficiently evaluating in a
type-stable way the network.
"""
input_type(net::NeuralNetwork) = error("Not Implemented")
"""
out_type(net) -> Type
Returns the numerical `eltype` of the output of the network.
"""
out_type(net::NeuralNetwork) = error("Not Implemented")
"""
input_shape(net)
This returns the shape of the numerical input that should be provided to the
network, inside a tuple. This is basically the shape of the input layer.
If the network encodes a Matrix, then it will be a tuple with two equal-length
states. If the network encodes a Ket it will be a tuple with a single element
of length equal to the number of input units.
"""
input_shape(net::NeuralNetwork) = error("Not Implemented")
"""
random_input_state(net)
Returns a random input state that can be fed into the network. This is not of
type `State`, but is rather the underlying numerical values.
This method is used for testing and to construct states. The shape of the state
will be the same of `input_shape`.
"""
random_input_state(net::NeuralNetwork) = error("Not Implemented")
"""
is_analytic(net) -> Bool
Returns true if the network is an analytic function (almost everywhere) or if it
has real weights.
"""
is_analytic(net::NeuralNetwork) = false
"""
num_params(net) -> Net
Returns the total number of parameters of the neural network.
"""
num_params(net::NeuralNetwork) = sum([length(getfield(net, f)) for f=fieldnames(typeof(net))])
# TODO does this even make sense?!
# the idea was that a shallow-copy of the weights of the net is not
# even a copy....
copy(net::NeuralNetwork) = net
|
A function $f$ is small $\omega$ if and only if it converges to infinity with respect to the filter $F$. |
lemma polynomial_function_add [intro]: "\<lbrakk>polynomial_function f; polynomial_function g\<rbrakk> \<Longrightarrow> polynomial_function (\<lambda>x. f x + g x)" |
[STATEMENT]
lemma "\<lfloor>(\<lambda>X. \<^bold>\<diamond>\<^bold>\<exists>X) \<^bold>\<down>(P::\<up>\<langle>\<up>\<zero>\<rangle>) \<^bold>\<rightarrow> (\<lambda>X. \<^bold>\<exists>X) \<^bold>\<down>P\<rfloor>"
[PROOF STATE]
proof (prove)
goal (1 subgoal):
1. \<lfloor>(\<lambda>w. (\<^bold>\<diamond>\<lparr>mexistsB P w\<rparr> \<^bold>\<rightarrow> mexistsB P) w)\<rfloor>
[PROOF STEP]
by simp |
#ifndef _PC_PATCH_H
#define _PC_PATCH_H
#include <petsc.h>
PETSC_EXTERN PetscErrorCode PCPatchInitializePackage(void);
PETSC_EXTERN PetscErrorCode PCCreate_PATCH(PC);
PETSC_EXTERN PetscErrorCode PCPatchSetCellNumbering(PC, PetscSection);
PETSC_EXTERN PetscErrorCode PCPatchSetDiscretisationInfo(PC, PetscInt, DM *, PetscInt *, PetscInt *, const PetscInt **, const PetscInt *, PetscInt, const PetscInt *, PetscInt, const PetscInt *);
PETSC_EXTERN PetscErrorCode PCPatchSetComputeOperator(PC, PetscErrorCode (*)(PC,Mat,PetscInt,const PetscInt *,PetscInt,const PetscInt *,void *),
void *);
typedef enum {PC_PATCH_STAR, PC_PATCH_VANKA, PC_PATCH_USER, PC_PATCH_PYTHON} PCPatchConstructType;
PETSC_EXTERN const char *const PCPatchConstructTypes[];
#endif
|
Formal statement is: theorem Landau_Picard: obtains R where "\<And>z. 0 < R z" "\<And>f. \<lbrakk>f holomorphic_on cball 0 (R(f 0)); \<And>z. norm z \<le> R(f 0) \<Longrightarrow> f z \<noteq> 0 \<and> f z \<noteq> 1\<rbrakk> \<Longrightarrow> norm(deriv f 0) < 1" Informal statement is: For every holomorphic function $f$ defined on a neighborhood of the origin, there exists a radius $R$ such that if $f$ is nonzero and nonconstant on the disk of radius $R$, then the derivative of $f$ at the origin is less than $1$ in absolute value. |
/*
* Author : Pierre Schnizer
* Date : February 2005
*
*/
#include <pygsl/error_helpers.h>
#include <pygsl/block_helpers.h>
#include <pygsl/pygsl_features.h>
#include <string.h>
#include <gsl/gsl_fft.h>
#include <gsl/gsl_fft_complex.h>
#include <gsl/gsl_fft_real.h>
#include <gsl/gsl_fft_halfcomplex.h>
#include <gsl/gsl_fft_complex_float.h>
#include <gsl/gsl_fft_real_float.h>
#include <gsl/gsl_fft_halfcomplex_float.h>
#include <gsl/gsl_blas.h>
#ifdef _PYGSL_GSL_HAS_WAVELET
#define forward forward_wavelet
#define backward backward_wavelet
#include <gsl/gsl_wavelet.h>
#include <gsl/gsl_wavelet2d.h>
#undef forward
#undef backward
#else
/*
#error Need GSL version 1.6 or higher with wavelet implementation! If you need it for a lower version
#error add the different conditional compilation!
*/
#endif /* gsl version > 1.5*/
static PyObject *module = NULL;
static const char filename[] = __FILE__;
/* The types */
#include "transformtypes.h"
/* The documentation strings */
#include "doc.h"
/* The python type which allows to allocate and pass the work space */
#include "space.c"
/* Function to copy the different arrays. */
#include "arraycopy.c"
/*
* Macros and functions which set the information up and call the
* PyGSL_transform functions
*/
#include "fft.c"
/*
* The wavelet type and the methods to call the different transform functions.
*/
#ifdef _PYGSL_GSL_HAS_WAVELET
#include "wavelet.c"
#define PyGSL_WAVELET_TRANSFORM_TYPE(name) \
{#name, PyGSL_wavelet_init_ ## name, METH_VARARGS, NULL}, \
{#name "_centered", PyGSL_wavelet_init_ ## name ## _centered, METH_VARARGS, NULL},
#else
#define PyGSL_WAVELET_TRANSFORM_TYPE(name)
#endif
/*
* The real workers.
*/
#include "core.c"
static PyMethodDef transformMethods[] = {
/* workspace init functions */
{"complex_workspace", PyGSL_transform_space_init_COMPLEX_WORKSPACE, METH_VARARGS, (char*)cws_doc},
{"complex_wavetable", PyGSL_transform_space_init_COMPLEX_WAVETABLE, METH_VARARGS, (char*)cwt_doc},
{"real_workspace", PyGSL_transform_space_init_REAL_WORKSPACE, METH_VARARGS, (char*)rws_doc},
{"real_wavetable", PyGSL_transform_space_init_REAL_WAVETABLE, METH_VARARGS, (char*)rwt_doc},
{"halfcomplex_wavetable", PyGSL_transform_space_init_HALFCOMPLEX_WAVETABLE, METH_VARARGS, (char*)hcwt_doc},
{"complex_workspace_float", PyGSL_transform_space_init_COMPLEX_WORKSPACE_FLOAT, METH_VARARGS, (char*)cws_doc},
{"complex_wavetable_float", PyGSL_transform_space_init_COMPLEX_WAVETABLE_FLOAT, METH_VARARGS, (char*)cwt_doc},
{"real_workspace_float", PyGSL_transform_space_init_REAL_WORKSPACE_FLOAT, METH_VARARGS, (char*)rws_doc},
{"real_wavetable_float", PyGSL_transform_space_init_REAL_WAVETABLE_FLOAT, METH_VARARGS, (char*)rwt_doc},
{"halfcomplex_wavetable_float", PyGSL_transform_space_init_HALFCOMPLEX_WAVETABLE_FLOAT, METH_VARARGS, (char*)hcwt_doc},
#ifdef _PYGSL_GSL_HAS_WAVELET
{"wavelet_workspace", PyGSL_transform_space_init_WAVELET_WORKSPACE, METH_VARARGS, (char*)ww_doc},
#endif
/* transform functions */
PyGSL_TRANSFORM_FD_FUNCTION("complex_forward", fft_complex_forward, cf_doc)
PyGSL_TRANSFORM_FD_FUNCTION("complex_backward", fft_complex_backward, cb_doc)
PyGSL_TRANSFORM_FD_FUNCTION("complex_inverse", fft_complex_inverse, ci_doc)
PyGSL_TRANSFORM_FD_FUNCTION("complex_radix2_forward", fft_complex_radix2_forward, cf_doc_r2)
PyGSL_TRANSFORM_FD_FUNCTION("complex_radix2_backward", fft_complex_radix2_backward, cb_doc_r2)
PyGSL_TRANSFORM_FD_FUNCTION("complex_radix2_inverse", fft_complex_radix2_inverse, ci_doc_r2)
PyGSL_TRANSFORM_FD_FUNCTION("complex_radix2_dif_forward", fft_complex_radix2_dif_forward, cf_doc_r2_dif)
PyGSL_TRANSFORM_FD_FUNCTION("complex_radix2_dif_backward", fft_complex_radix2_dif_backward, cb_doc_r2_dif)
PyGSL_TRANSFORM_FD_FUNCTION("complex_radix2_dif_inverse", fft_complex_radix2_dif_inverse, ci_doc_r2_dif)
PyGSL_TRANSFORM_FD_FUNCTION("real_transform", fft_real_transform, rt_doc)
PyGSL_TRANSFORM_FD_FUNCTION("halfcomplex_transform", fft_halfcomplex_transform, hc_doc)
PyGSL_TRANSFORM_FD_FUNCTION("halfcomplex_inverse", fft_halfcomplex_inverse, hi_doc)
PyGSL_TRANSFORM_FD_FUNCTION("real_radix2_transform", fft_real_radix2_transform, rt_doc_r2)
PyGSL_TRANSFORM_FD_FUNCTION("halfcomplex_radix2_transform",fft_halfcomplex_radix2_transform, hc_doc_r2)
PyGSL_TRANSFORM_FD_FUNCTION("halfcomplex_radix2_inverse", fft_halfcomplex_radix2_inverse, hi_doc_r2)
/* helper functions */
{"halfcomplex_radix2_unpack", PyGSL_fft_halfcomplex_radix2_unpack, METH_VARARGS, (char*)un_doc_r2},
{"halfcomplex_radix2_unpack_float", PyGSL_fft_halfcomplex_radix2_unpack_float, METH_VARARGS, (char*)float_doc},
/* wavelet inits */
#ifdef _PYGSL_GSL_HAS_WAVELET
PyGSL_WAVELET_TRANSFORM_TYPE(daubechies)
PyGSL_WAVELET_TRANSFORM_TYPE(haar)
PyGSL_WAVELET_TRANSFORM_TYPE(bspline)
#endif
{NULL, NULL, 0, NULL} /* Sentinel */
};
/*
* Set the various function pointers for the different transforms. See the
* structure _pygsl_transform_func_s for the functions. Some architectures do
* not allow to initalise function pointers in static structures on the heap.
* (some solaris versions? )
*/
#define PYGSL_INIT_FUNCS(helpers, space, table, spacet, tablet) \
helpers.space_alloc = (pygsl_transform_helpn_t *) gsl_fft_ ## space ## _alloc; \
helpers.space_free = (pygsl_transform_help_t *) gsl_fft_ ## space ## _free; \
helpers.table_alloc = (pygsl_transform_helpn_t *) gsl_fft_ ## table ## _alloc; \
helpers.table_free = (pygsl_transform_help_t *) gsl_fft_ ## table ## _free; \
helpers.space_type = spacet; \
helpers.table_type = tablet; \
#define PYGSL_INIT_FUNCS_DF(helpers, space, table, spacet, tablet) \
PYGSL_INIT_FUNCS(helpers ## _funcs, space, table, spacet, tablet) \
PYGSL_INIT_FUNCS(helpers ## _float ## _funcs, space ## _float, table ## _float, spacet ## _FLOAT, tablet ## _FLOAT)
static void
init_helpers(void)
{
FUNC_MESS_BEGIN();
PYGSL_INIT_FUNCS_DF(complex, complex_workspace, complex_wavetable, COMPLEX_WORKSPACE, COMPLEX_WAVETABLE)
PYGSL_INIT_FUNCS_DF(real, real_workspace, real_wavetable, REAL_WORKSPACE, REAL_WAVETABLE)
PYGSL_INIT_FUNCS_DF(halfcomplex, real_workspace, halfcomplex_wavetable, REAL_WORKSPACE, HALFCOMPLEX_WAVETABLE)
DEBUG_MESS(3, "PyArray_FLOAT = %d ", PyArray_FLOAT );
DEBUG_MESS(3, "PyArray_DOUBLE = %d ", PyArray_DOUBLE );
DEBUG_MESS(3, "PyArray_CFLOAT = %d ", PyArray_CFLOAT );
DEBUG_MESS(3, "PyArray_CDOUBLE = %d ", PyArray_CDOUBLE);
#ifdef _PYGSL_GSL_HAS_WAVELET
DEBUG_MESS(4, "%s @ %p", "daubechies", gsl_wavelet_daubechies);
DEBUG_MESS(4, "%s @ %p", "daubechies_centered", gsl_wavelet_daubechies_centered);
DEBUG_MESS(4, "%s @ %p", "haar", gsl_wavelet_haar);
DEBUG_MESS(4, "%s @ %p", "haar_centered", gsl_wavelet_haar_centered);
DEBUG_MESS(4, "%s @ %p", "bspline", gsl_wavelet_bspline);
DEBUG_MESS(4, "%s @ %p", "bspline_centered", gsl_wavelet_bspline_centered);
#endif
FUNC_MESS_END();
}
DL_EXPORT(void) init_transform(void)
{
PyObject *m = NULL, *dict = NULL, *item = NULL;
FUNC_MESS_BEGIN();
PyGSL_transform_space_pytype.ob_type = &PyType_Type;
#ifdef _PYGSL_GSL_HAS_WAVELET
PyGSL_wavelet_pytype.ob_type = &PyType_Type;
#endif
m = Py_InitModule("_transform", transformMethods);
module = m;
init_pygsl();
init_helpers();
if (m == NULL)
return;
dict = PyModule_GetDict(m);
if (dict == NULL)
return;
if (!(item = PyString_FromString(transform_module_doc))){
PyErr_SetString(PyExc_ImportError,
"I could not generate module doc string!");
return;
}
if (PyDict_SetItemString(dict, "__doc__", item) != 0){
PyErr_SetString(PyExc_ImportError,
"I could not init doc string!");
return;
}
FUNC_MESS_END();
return;
}
/*
* Local Variables:
* mode: C
* c-file-style: "python"
* End:
*/
|
{-# OPTIONS --safe --cubical #-}
module Data.Pi.Base where
open import Level
Π : (A : Type a) (B : A → Type b) → Type _
Π A B = (x : A) → B x
∀′ : {A : Type a} (B : A → Type b) → Type _
∀′ {A = A} B = Π A B
infixr 4.5 ∀-syntax
∀-syntax : ∀ {a b} {A : Type a} (B : A → Type b) → Type (a ℓ⊔ b)
∀-syntax = ∀′
syntax ∀-syntax (λ x → e) = ∀[ x ] e
infixr 4.5 Π⦂-syntax
Π⦂-syntax : (A : Type a) (B : A → Type b) → Type (a ℓ⊔ b)
Π⦂-syntax = Π
syntax Π⦂-syntax t (λ x → e) = Π[ x ⦂ t ] e
|
theory Tactics
imports Poly
begin
section {* Tactics *}
(* theorem silly1: "\<forall> n m p q::nat. n = m \<longrightarrow> [n, p] = [n, q] \<longrightarrow> [n, p] = [m, q]" *)
theorem silly1: "n = m \<longrightarrow> [n, p] = [n, q] \<longrightarrow> [n, p] = [m, q]"
apply (simp)
done
theorem silly_ex: "evenb n = True \<longrightarrow> oddb (Suc n) = True \<longrightarrow> evenb (Suc (Suc 1)) = True \<longrightarrow> oddb 4 = True"
apply (simp)
done
theorem rev_exercise1: "xs = rev ys \<longrightarrow> ys = rev xs"
apply (simp add: rev_involutive)
done
subsection {* The apply ... with ... Tactic *}
lemma trans_eq_example: "[a, b] = [c, d] \<longrightarrow> [c, d] = [e, f] \<longrightarrow> [a, b] = [e, f]"
apply (simp)
done
lemma trans_eq: "n = m \<longrightarrow> m = p \<longrightarrow> n = p"
apply (simp)
done
lemma trans_eq_exercise: "m = minustwo p \<longrightarrow> n + q = m \<longrightarrow> n + q = minustwo p"
apply (simp)
done
subsection {* The inversion tactic *}
theorem S_inversion: "\<forall> n m::nat. Suc n = Suc m \<longrightarrow> n = m"
apply (simp)
done
theorem inversion_ex1: "\<forall> n m p::nat. (n # m # []) = (p # p # []) \<longrightarrow> (n # []) = (m # [])"
apply (simp)
done
theorem inversion_ex2: "\<forall> n m::nat. (n # []) = (m # []) \<longrightarrow> n = m"
apply (simp)
done
theorem inversion_ex3: "x # y # l = z # j \<longrightarrow> y # l = x # j \<longrightarrow> x = y"
apply (auto)
done
theorem inversion_ex6: "x # y # l = [] \<longrightarrow> y # l = z # j \<longrightarrow> x = z"
apply (simp)
done
theorem f_equal: "x = y \<longrightarrow> f x = f y"
apply (simp)
done
subsection {* Using tactic on Hypotheses *}
theorem S_inj: "\<forall> n m::nat. beq_nat (Suc n) (Suc m) = b \<longrightarrow> beq_nat n m = b"
apply (simp)
done
theorem plus_n_n_injective: "\<forall> n m::nat. n + n = m + m \<longrightarrow> n = m"
apply (simp)
done
subsection {* Varying the induction Hypotheses *}
theorem beq_nat_true: "beq_nat n m = True \<longrightarrow> n = m"
oops
subsection {* Unfolding Definition *}
definition square ::"nat \<Rightarrow> nat" where
"square n = n * n"
lemma square_multi: "square (n * m) = (square n) * (square m)"
unfolding Tactics.square_def
apply (simp)
done
definition foo ::"nat \<Rightarrow> nat" where "foo _ = 5"
theorem silly_fact_1: "foo m + 1 = foo (m + 1) + 1"
unfolding Tactics.foo_def
apply (simp)
done
fun bar ::"nat \<Rightarrow> nat" where
"bar 0 = 5"
| "bar (Suc n) = 5"
theorem silly_fact_2: "bar m + 1 = bar (m + 1) + 1"
apply (induction m)
apply (simp_all)
done
subsection {* Using destruct on Compound Expressions *}
definition sillyfun :: "nat \<Rightarrow> bool" where
"sillyfun n = (if n = 3 then False else (if n = 5 then False else False))"
theorem sillyfun_false: "sillyfun n = False"
unfolding sillyfun_def
apply (simp)
done
theorem combine_split: "split xs = (ys, zs) \<longrightarrow> combine ys zs = xs"
oops
end
|
# Check if RStudio is running to set the working directory to the script directory
# https://stackoverflow.com/questions/35986037/detect-if-an-r-session-is-run-in-rstudio-at-startup
is.na(Sys.getenv("RSTUDIO", unset = NA))
if (!is.na(Sys.getenv("RSTUDIO", unset = NA))) {
# Get current directory
current_dir <- dirname(rstudioapi::getSourceEditorContext()$path)
# Set working directory to current directory (script directory)
setwd(current_dir)
} else {
# If sourced https://stackoverflow.com/questions/13672720/r-command-for-setting-working-directory-to-source-file-location-in-rstudio
this.dir <- dirname(parent.frame(2)$ofile)
setwd(this.dir)
}
# Include the excel helper functions
source("excelhelper.r")
# We are going to use the diamonds data set that comes with ggplot2
library(ggplot2)
diamonds<- data.frame(diamonds)
# Let's rename columns 8, 9, and 10.
names(diamonds)[8]<-"length"
names(diamonds)[9]<-"width"
names(diamonds)[10]<-"depth"
# now we have two columns named depth. Let's rename the first one (column 5) to "depthperc."
names(diamonds)[5]<-"depthperc"
# Write the result
writeResult(tablenames = list("result"=diamonds))
# Signal the end of the process
done()
# free up all variables
rm(list=ls())
|
## these are our arguments:
#fprepix <- "fname"
#wdir <- "."
#partition_ref_path <- "./partition_files/"
library(parallel)
## these are our functions we want to run
func_list_list <- list(
## circos plot first since it's the slowest
##list("genomewide_Circular_genome_data_visualization",list(fprefix=fprefix,wdir=wdir)),
## then genomic partition
list("genomewide_Genomewide_distribution_patterns_of_small_RNA_loci",list(fprefix=fprefix,wdir=wdir,partition_ref_path=partition_ref_path)),
## then the philadelphia plot
list("genomewide_Genomewide_distribution_of_expressed_small_RNA_loci",list(fprefix=fprefix,wdir=wdir)),
## Segmentation characteristics
list("segmentation_Length_Distribution_of_RPM_of_segmented_loci",list(fprefix=fprefix,wdir=wdir)),
list("segmentation_Genomic_length_distribution_of_identified_small_RNA_loci",list(fprefix=fprefix,wdir=wdir)),
## Length and Expression characteristics
## list("lengthexpression_RPM_and_length_of_all_loci_across_RNA_classes",list(fprefix=fprefix,wdir=wdir)),
## list("lengthexpression_proportion_of_mapped_reads_all_loci",list(fprefix=fprefix,wdir=wdir)),
list("lengthexpression_RPM_distribution_of_identified_small_RNA_loci",list(fprefix=fprefix,wdir=wdir)),
list("lengthexpression_Percentile_distribution_of_identified_small_RNA_loci_across_different_lengths",list(fprefix=fprefix,wdir=wdir)),
## Processing characteristics
list("processing_5p_end_positional_offset_between_identified_loci_and_small_RNA_gene",list(fprefix=fprefix,wdir=wdir)),
list("processing_Processing_specificity_at_5p_end_of_identified_small_RNA_loci",list(fprefix=fprefix,wdir=wdir)),
list("processing_Read_pipeup_at_5p_end_of_identified_small_RNA_loci",list(fprefix=fprefix,wdir=wdir)),
## Genomewide characteristics
list("proportion_of_mapped_reads_across_all_loci",list(fprefix=fprefix,wdir=wdir)),
list("genomewide_Proportion_of_expressed_annotated_small_RNA_genes",list(fprefix=fprefix,wdir=wdir))
)
## source everything (these cant have function calls in them)
#r_files <- list.files(path="SPAR-master/scripts/R/module3",pattern="^M.+\\.r$",full.names=TRUE)
#r_files <- list.files(path="scripts/R/module3",pattern="^M.+\\.r$",full.names=TRUE)
r_files <- list.files(path = paste0(SPAR_path, "/scripts/R/module3"), pattern = "^M.+\\.r$", full.names=TRUE)
lapply(r_files, source)
## make our cluster
clust <- makeCluster(detectCores(), outfile=paste0(wdir, "/../logs/parallel_r_output.log"))
clusterExport(cl=clust, varlist=unlist(lapply(func_list_list, "[[", 1)))
## parLapply(clust, func_list_list,
## function(func_list) { func <- func_list[[1]]
## func_args <- func_list[[2]]
## do.call(func, func_args) })
clusterApply(clust, func_list_list,
function(func_list) { func <- func_list[[1]]
func_args <- func_list[[2]]
do.call(func, func_args) })
stopCluster(clust)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.