statement
stringlengths
1
2.93k
proof
stringlengths
0
19.2k
type
stringclasses
13 values
symbolic_name
stringlengths
1
131
library
stringlengths
4
62
filename
stringlengths
20
95
imports
listlengths
0
10
deps
listlengths
0
64
docstring
stringlengths
0
4.95k
source_url
stringclasses
1 value
commit
stringclasses
1 value
continuousLinearMap_symm_apply' {b : B} (hb : b ∈ e₁.baseSet ∩ e₂.baseSet) (L : F₁ →SL[σ] F₂) : (continuousLinearMap σ e₁ e₂).symm b L = (e₂.symmL 𝕜₂ b).comp (L.comp <| e₁.continuousLinearMapAt 𝕜₁ b)
by rw [symm_apply] · rfl · exact hb
theorem
Bundle.Pretrivialization.continuousLinearMap_symm_apply'
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "symm" ]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
continuousLinearMapCoordChange_apply (b : B) (hb : b ∈ e₁.baseSet ∩ e₂.baseSet ∩ (e₁'.baseSet ∩ e₂'.baseSet)) (L : F₁ →SL[σ] F₂) : continuousLinearMapCoordChange σ e₁ e₁' e₂ e₂' b L = (continuousLinearMap σ e₁' e₂' ⟨b, (continuousLinearMap σ e₁ e₂).symm b L⟩).2
by ext v simp_rw [continuousLinearMapCoordChange, ContinuousLinearEquiv.coe_coe, ContinuousLinearEquiv.arrowCongrSL_apply, continuousLinearMap_apply, continuousLinearMap_symm_apply' σ e₁ e₂ hb.1, comp_apply, ContinuousLinearEquiv.coe_coe, ContinuousLinearEquiv.symm_symm, Trivialization.continuousLinearM...
theorem
Bundle.Pretrivialization.continuousLinearMapCoordChange_apply
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "ContinuousLinearEquiv.coe_coe", "ContinuousLinearEquiv.symm_symm", "symm" ]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Bundle.ContinuousLinearMap.vectorPrebundle : VectorPrebundle 𝕜₂ (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x)
where pretrivializationAtlas := {e | ∃ (e₁ : Trivialization F₁ (π F₁ E₁)) (e₂ : Trivialization F₂ (π F₂ E₂)) (_ : MemTrivializationAtlas e₁) (_ : MemTrivializationAtlas e₂), e = Pretrivialization.continuousLinearMap σ e₁ e₂} pretrivialization_linear' := by rintro _ ⟨e₁, he₁, e₂, he₂, rfl⟩ ...
def
Bundle.ContinuousLinearMap.vectorPrebundle
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "MemTrivializationAtlas", "Trivialization", "Trivialization.linearMapAt_def_of_mem", "VectorPrebundle" ]
The continuous `σ`-semilinear maps between two topological vector bundles form a `VectorPrebundle` (this is an auxiliary construction for the `VectorBundle` instance, in which the pretrivializations are collated but no topology on the total space is yet provided).
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Bundle.ContinuousLinearMap.topologicalSpaceTotalSpace : TopologicalSpace (TotalSpace (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x))
(Bundle.ContinuousLinearMap.vectorPrebundle σ F₁ E₁ F₂ E₂).totalSpaceTopology
instance
Bundle.ContinuousLinearMap.topologicalSpaceTotalSpace
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "Bundle.ContinuousLinearMap.vectorPrebundle", "TopologicalSpace" ]
Topology on the total space of the continuous `σ`-semilinear maps between two "normable" vector bundles over the same base.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Bundle.ContinuousLinearMap.fiberBundle : FiberBundle (F₁ →SL[σ] F₂) fun x ↦ E₁ x →SL[σ] E₂ x
(Bundle.ContinuousLinearMap.vectorPrebundle σ F₁ E₁ F₂ E₂).toFiberBundle
instance
Bundle.ContinuousLinearMap.fiberBundle
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "Bundle.ContinuousLinearMap.vectorPrebundle", "FiberBundle" ]
The continuous `σ`-semilinear maps between two vector bundles form a fiber bundle.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Bundle.ContinuousLinearMap.vectorBundle : VectorBundle 𝕜₂ (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x)
(Bundle.ContinuousLinearMap.vectorPrebundle σ F₁ E₁ F₂ E₂).toVectorBundle
instance
Bundle.ContinuousLinearMap.vectorBundle
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "Bundle.ContinuousLinearMap.vectorPrebundle", "VectorBundle" ]
The continuous `σ`-semilinear maps between two vector bundles form a vector bundle.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Bundle.Trivialization.continuousLinearMap : Trivialization (F₁ →SL[σ] F₂) (π (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x))
VectorPrebundle.trivializationOfMemPretrivializationAtlas _ ⟨e₁, e₂, he₁, he₂, rfl⟩
def
Bundle.Trivialization.continuousLinearMap
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "Trivialization", "VectorPrebundle.trivializationOfMemPretrivializationAtlas" ]
Given trivializations `e₁`, `e₂` in the atlas for vector bundles `E₁`, `E₂` over a base `B`, the induced trivialization for the continuous `σ`-semilinear maps from `E₁` to `E₂`, whose base set is `e₁.baseSet ∩ e₂.baseSet`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Bundle.ContinuousLinearMap.memTrivializationAtlas : MemTrivializationAtlas (e₁.continuousLinearMap σ e₂ : Trivialization (F₁ →SL[σ] F₂) (π (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x)))
where out := ⟨_, ⟨e₁, e₂, by infer_instance, by infer_instance, rfl⟩, rfl⟩
instance
Bundle.ContinuousLinearMap.memTrivializationAtlas
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "MemTrivializationAtlas", "Trivialization" ]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Bundle.Trivialization.baseSet_continuousLinearMap : (e₁.continuousLinearMap σ e₂).baseSet = e₁.baseSet ∩ e₂.baseSet
rfl
theorem
Bundle.Trivialization.baseSet_continuousLinearMap
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Bundle.Trivialization.continuousLinearMap_apply (p : TotalSpace (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x)) : e₁.continuousLinearMap σ e₂ p = ⟨p.1, (e₂.continuousLinearMapAt 𝕜₂ p.1 : _ →L[𝕜₂] _).comp (p.2.comp (e₁.symmL 𝕜₁ p.1 : F₁ →L[𝕜₁] E₁ p.1) : F₁ →SL[σ] E₂ p.1)⟩
rfl
theorem
Bundle.Trivialization.continuousLinearMap_apply
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
hom_trivializationAt (x₀ : B) : trivializationAt (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x) x₀ = (trivializationAt F₁ E₁ x₀).continuousLinearMap σ (trivializationAt F₂ E₂ x₀)
rfl
theorem
hom_trivializationAt
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
hom_trivializationAt_apply (x₀ : B) (x : TotalSpace (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x)) : trivializationAt (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x) x₀ x = ⟨x.1, inCoordinates F₁ E₁ F₂ E₂ x₀ x.1 x₀ x.1 x.2⟩
rfl
theorem
hom_trivializationAt_apply
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
hom_trivializationAt_source (x₀ : B) : (trivializationAt (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x) x₀).source = π (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x) ⁻¹' ((trivializationAt F₁ E₁ x₀).baseSet ∩ (trivializationAt F₂ E₂ x₀).baseSet)
rfl
theorem
hom_trivializationAt_source
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
hom_trivializationAt_target (x₀ : B) : (trivializationAt (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x) x₀).target = ((trivializationAt F₁ E₁ x₀).baseSet ∩ (trivializationAt F₂ E₂ x₀).baseSet) ×ˢ Set.univ
rfl
theorem
hom_trivializationAt_target
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "Set.univ" ]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
hom_trivializationAt_baseSet (x₀ : B) : (trivializationAt (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x) x₀).baseSet = ((trivializationAt F₁ E₁ x₀).baseSet ∩ (trivializationAt F₂ E₂ x₀).baseSet)
rfl
theorem
hom_trivializationAt_baseSet
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
continuousWithinAt_hom_bundle {M : Type*} [TopologicalSpace M] (f : M → TotalSpace (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x)) {s : Set M} {x₀ : M} : ContinuousWithinAt f s x₀ ↔ ContinuousWithinAt (fun x ↦ (f x).1) s x₀ ∧ ContinuousWithinAt (fun x ↦ inCoordinates F₁ E₁ F₂ E₂ (f x₀).1 (f x...
FiberBundle.continuousWithinAt_totalSpace ..
theorem
continuousWithinAt_hom_bundle
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "ContinuousWithinAt", "FiberBundle.continuousWithinAt_totalSpace", "Set", "TopologicalSpace" ]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
continuousAt_hom_bundle {M : Type*} [TopologicalSpace M] (f : M → TotalSpace (F₁ →SL[σ] F₂) (fun x ↦ E₁ x →SL[σ] E₂ x)) {x₀ : M} : ContinuousAt f x₀ ↔ ContinuousAt (fun x ↦ (f x).1) x₀ ∧ ContinuousAt (fun x ↦ inCoordinates F₁ E₁ F₂ E₂ (f x₀).1 (f x).1 (f x₀).1 (f x).1 (f x).2) x₀
FiberBundle.continuousAt_totalSpace ..
theorem
continuousAt_hom_bundle
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "ContinuousAt", "FiberBundle.continuousAt_totalSpace", "TopologicalSpace" ]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
ContinuousWithinAt.clm_apply_of_inCoordinates (hϕ : ContinuousWithinAt (fun m ↦ inCoordinates F₁ E₁ F₂ E₂ (b₁ m₀) (b₁ m) (b₂ m₀) (b₂ m) (ϕ m)) s m₀) (hv : ContinuousWithinAt (fun m ↦ (v m : TotalSpace F₁ E₁)) s m₀) (hb₂ : ContinuousWithinAt b₂ s m₀) : ContinuousWithinAt (fun m ↦ (ϕ m (v m) : Total...
by rw [← continuousWithinAt_insert_self] at hϕ hv hb₂ ⊢ rw [FiberBundle.continuousWithinAt_totalSpace] at hv ⊢ refine ⟨hb₂, ?_⟩ apply (ContinuousWithinAt.clm_apply hϕ hv.2).congr_of_eventuallyEq_of_mem ?_ (mem_insert m₀ s) have A : ∀ᶠ m in 𝓝[insert m₀ s] m₀, b₁ m ∈ (trivializationAt F₁ E₁ (b₁ m₀)).baseSet :=...
lemma
ContinuousWithinAt.clm_apply_of_inCoordinates
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "ContinuousWithinAt", "ContinuousWithinAt.clm_apply", "FiberBundle.continuousWithinAt_totalSpace", "continuousWithinAt_insert_self" ]
Consider a continuous map `v : M → E₁` to a vector bundle, over a base map `b₁ : M → B₁`, and another basemap `b₂ : M → B₂`. Given linear maps `ϕ m : E₁ (b₁ m) → E₂ (b₂ m)` depending continuously on `m`, one can apply `ϕ m` to `g m`, and the resulting map is continuous. Note that the continuity of `ϕ` cannot be always...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
ContinuousAt.clm_apply_of_inCoordinates (hϕ : ContinuousAt (fun m ↦ inCoordinates F₁ E₁ F₂ E₂ (b₁ m₀) (b₁ m) (b₂ m₀) (b₂ m) (ϕ m)) m₀) (hv : ContinuousAt (fun m ↦ (v m : TotalSpace F₁ E₁)) m₀) (hb₂ : ContinuousAt b₂ m₀) : ContinuousAt (fun m ↦ (ϕ m (v m) : TotalSpace F₂ E₂)) m₀
by rw [← continuousWithinAt_univ] at hϕ hv hb₂ ⊢ exact hϕ.clm_apply_of_inCoordinates hv hb₂
lemma
ContinuousAt.clm_apply_of_inCoordinates
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "ContinuousAt", "continuousWithinAt_univ" ]
Consider a continuous map `v : M → E₁` to a vector bundle, over a base map `b₁ : M → B₁`, and another basemap `b₂ : M → B₂`. Given linear maps `ϕ m : E₁ (b₁ m) → E₂ (b₂ m)` depending continuously on `m`, one can apply `ϕ m` to `g m`, and the resulting map is continuous. Note that the continuity of `ϕ` cannot be always...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
ContinuousWithinAt.clm_bundle_apply (hϕ : ContinuousWithinAt (fun m ↦ TotalSpace.mk' (F₁ →L[𝕜] F₂) (E := fun (x : B) ↦ (E₁ x →L[𝕜] E₂ x)) (b m) (ϕ m)) s x) (hv : ContinuousWithinAt (fun m ↦ TotalSpace.mk' F₁ (b m) (v m)) s x) : ContinuousWithinAt (fun m ↦ TotalSpace.mk' F₂ (b m) (ϕ m (v ...
by simp only [continuousWithinAt_hom_bundle] at hϕ exact hϕ.2.clm_apply_of_inCoordinates hv hϕ.1
lemma
ContinuousWithinAt.clm_bundle_apply
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "ContinuousWithinAt", "continuousWithinAt_hom_bundle" ]
Consider a `C^n` map `v : M → E₁` to a vector bundle, over a basemap `b : M → B`, and linear maps `ϕ m : E₁ (b m) → E₂ (b m)` depending smoothly on `m`. One can apply `ϕ m` to `v m`, and the resulting map is `C^n`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
ContinuousAt.clm_bundle_apply (hϕ : ContinuousAt (fun m ↦ TotalSpace.mk' (F₁ →L[𝕜] F₂) (E := fun (x : B) ↦ (E₁ x →L[𝕜] E₂ x)) (b m) (ϕ m)) x) (hv : ContinuousAt (fun m ↦ TotalSpace.mk' F₁ (b m) (v m)) x) : ContinuousAt (fun m ↦ TotalSpace.mk' F₂ (b m) (ϕ m (v m))) x
by simp only [← continuousWithinAt_univ] at hϕ hv ⊢ exact hϕ.clm_bundle_apply hv
lemma
ContinuousAt.clm_bundle_apply
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "ContinuousAt", "continuousWithinAt_univ" ]
Consider a `C^n` map `v : M → E₁` to a vector bundle, over a basemap `b : M → B`, and linear maps `ϕ m : E₁ (b m) → E₂ (b m)` depending smoothly on `m`. One can apply `ϕ m` to `v m`, and the resulting map is `C^n`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
ContinuousOn.clm_bundle_apply (hϕ : ContinuousOn (fun m ↦ TotalSpace.mk' (F₁ →L[𝕜] F₂) (E := fun (x : B) ↦ (E₁ x →L[𝕜] E₂ x)) (b m) (ϕ m)) s) (hv : ContinuousOn (fun m ↦ TotalSpace.mk' F₁ (b m) (v m)) s) : ContinuousOn (fun m ↦ TotalSpace.mk' F₂ (b m) (ϕ m (v m))) s
fun x hx ↦ (hϕ x hx).clm_bundle_apply (hv x hx)
lemma
ContinuousOn.clm_bundle_apply
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "ContinuousOn" ]
Consider a `C^n` map `v : M → E₁` to a vector bundle, over a basemap `b : M → B`, and linear maps `ϕ m : E₁ (b m) → E₂ (b m)` depending smoothly on `m`. One can apply `ϕ m` to `v m`, and the resulting map is `C^n`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Continuous.clm_bundle_apply (hϕ : Continuous (fun m ↦ TotalSpace.mk' (F₁ →L[𝕜] F₂) (E := fun (x : B) ↦ (E₁ x →L[𝕜] E₂ x)) (b m) (ϕ m))) (hv : Continuous (fun m ↦ TotalSpace.mk' F₁ (b m) (v m))) : Continuous (fun m ↦ TotalSpace.mk' F₂ (b m) (ϕ m (v m)))
by simp only [← continuousOn_univ] at hϕ hv ⊢ exact hϕ.clm_bundle_apply hv
lemma
Continuous.clm_bundle_apply
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "Continuous", "continuousOn_univ" ]
Consider a `C^n` map `v : M → E₁` to a vector bundle, over a basemap `b : M → B`, and linear maps `ϕ m : E₁ (b m) → E₂ (b m)` depending smoothly on `m`. One can apply `ϕ m` to `v m`, and the resulting map is `C^n`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
ContinuousWithinAt.clm_bundle_apply₂ (hψ : ContinuousWithinAt (fun m ↦ TotalSpace.mk' (F₁ →L[𝕜] F₂ →L[𝕜] F₃) (E := fun (x : B) ↦ (E₁ x →L[𝕜] E₂ x →L[𝕜] E₃ x)) (b m) (ψ m)) s x) (hv : ContinuousWithinAt (fun m ↦ TotalSpace.mk' F₁ (b m) (v m)) s x) (hw : ContinuousWithinAt (fun m ↦ TotalSpace.mk' F₂...
(hψ.clm_bundle_apply hv).clm_bundle_apply hw
lemma
ContinuousWithinAt.clm_bundle_apply₂
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "ContinuousWithinAt" ]
Consider `C^n` maps `v : M → E₁` and `v : M → E₂` to vector bundles, over a basemap `b : M → B`, and bilinear maps `ψ m : E₁ (b m) → E₂ (b m) → E₃ (b m)` depending smoothly on `m`. One can apply `ψ m` to `v m` and `w m`, and the resulting map is `C^n`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
ContinuousAt.clm_bundle_apply₂ (hψ : ContinuousAt (fun m ↦ TotalSpace.mk' (F₁ →L[𝕜] F₂ →L[𝕜] F₃) (E := fun (x : B) ↦ (E₁ x →L[𝕜] E₂ x →L[𝕜] E₃ x)) (b m) (ψ m)) x) (hv : ContinuousAt (fun m ↦ TotalSpace.mk' F₁ (b m) (v m)) x) (hw : ContinuousAt (fun m ↦ TotalSpace.mk' F₂ (b m) (w m)) x) : Conti...
(hψ.clm_bundle_apply hv).clm_bundle_apply hw
lemma
ContinuousAt.clm_bundle_apply₂
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "ContinuousAt" ]
Consider `C^n` maps `v : M → E₁` and `v : M → E₂` to vector bundles, over a basemap `b : M → B`, and bilinear maps `ψ m : E₁ (b m) → E₂ (b m) → E₃ (b m)` depending smoothly on `m`. One can apply `ψ m` to `v m` and `w m`, and the resulting map is `C^n`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
ContinuousOn.clm_bundle_apply₂ (hψ : ContinuousOn (fun m ↦ TotalSpace.mk' (F₁ →L[𝕜] F₂ →L[𝕜] F₃) (E := fun (x : B) ↦ (E₁ x →L[𝕜] E₂ x →L[𝕜] E₃ x)) (b m) (ψ m)) s) (hv : ContinuousOn (fun m ↦ TotalSpace.mk' F₁ (b m) (v m)) s) (hw : ContinuousOn (fun m ↦ TotalSpace.mk' F₂ (b m) (w m)) s) : ...
fun x hx ↦ (hψ x hx).clm_bundle_apply₂ (hv x hx) (hw x hx)
lemma
ContinuousOn.clm_bundle_apply₂
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "ContinuousOn" ]
Consider `C^n` maps `v : M → E₁` and `v : M → E₂` to vector bundles, over a basemap `b : M → B`, and bilinear maps `ψ m : E₁ (b m) → E₂ (b m) → E₃ (b m)` depending smoothly on `m`. One can apply `ψ m` to `v m` and `w m`, and the resulting map is `C^n`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Continuous.clm_bundle_apply₂ (hψ : Continuous (fun m ↦ TotalSpace.mk' (F₁ →L[𝕜] F₂ →L[𝕜] F₃) (E := fun (x : B) ↦ (E₁ x →L[𝕜] E₂ x →L[𝕜] E₃ x)) (b m) (ψ m))) (hv : Continuous (fun m ↦ TotalSpace.mk' F₁ (b m) (v m))) (hw : Continuous (fun m ↦ TotalSpace.mk' F₂ (b m) (w m))) : Continuous (fun m ↦...
by simp only [← continuousOn_univ] at hψ hv hw ⊢ exact hψ.clm_bundle_apply₂ hv hw
lemma
Continuous.clm_bundle_apply₂
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "Continuous", "continuousOn_univ" ]
Consider `C^n` maps `v : M → E₁` and `v : M → E₂` to vector bundles, over a basemap `b : M → B`, and bilinear maps `ψ m : E₁ (b m) → E₂ (b m) → E₃ (b m)` depending smoothly on `m`. One can apply `ψ m` to `v m` and `w m`, and the resulting map is `C^n`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
inCoordinates_apply_eq₂ {x₀ x : B} {ϕ : E₁ x →L[𝕜] E₂ x →L[𝕜] E₃ x} {v : F₁} {w : F₂} (h₁x : x ∈ (trivializationAt F₁ E₁ x₀).baseSet) (h₂x : x ∈ (trivializationAt F₂ E₂ x₀).baseSet) (h₃x : x ∈ (trivializationAt F₃ E₃ x₀).baseSet) : inCoordinates F₁ E₁ (F₂ →L[𝕜] F₃) (fun x ↦ E₂ x →L[𝕜] E₃ x) x₀ x...
by rw [inCoordinates_eq h₁x (by simp [h₂x, h₃x])] simp [hom_trivializationAt, Trivialization.continuousLinearMap_apply]
theorem
inCoordinates_apply_eq₂
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Hom.lean
[]
[ "hom_trivializationAt", "symm" ]
Rewrite `ContinuousLinearMap.inCoordinates` using continuous linear equivalences, in the bundle of bilinear maps.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
IsContinuousRiemannianBundle : Prop where /-- There exists a bilinear form, depending continuously on the basepoint and defining the inner product in the fibers. This is expressed as an existence statement so that it is Prop-valued in terms of existing data, the inner product on the fibers and the fiber bundle st...
class
IsContinuousRiemannianBundle
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Riemannian.lean
[]
[ "Continuous" ]
Consider a real vector bundle in which each fiber is endowed with an inner product. We say that the bundle is *Riemannian* if the inner product depends continuously on the base point. This assumption is spelled `IsContinuousRiemannianBundle F E` where `F` is the model fiber, and `E : B → Type*` is the bundle.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
ContinuousWithinAt.inner_bundle (hv : ContinuousWithinAt (fun m ↦ (v m : TotalSpace F E)) s x) (hw : ContinuousWithinAt (fun m ↦ (w m : TotalSpace F E)) s x) : ContinuousWithinAt (fun m ↦ ⟪v m, w m⟫) s x
by rcases h.exists_continuous with ⟨g, g_cont, hg⟩ have hf : ContinuousWithinAt b s x := by simp only [FiberBundle.continuousWithinAt_totalSpace] at hv exact hv.1 simp only [hg] have : ContinuousWithinAt (fun m ↦ TotalSpace.mk' ℝ (E := Bundle.Trivial B ℝ) (b m) (g (b m) (v m) (w m))) s x := (g...
lemma
ContinuousWithinAt.inner_bundle
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Riemannian.lean
[]
[ "Bundle.Trivial", "ContinuousWithinAt", "FiberBundle.continuousWithinAt_totalSpace" ]
Given two continuous maps into the same fibers of a continuous Riemannian bundle, their inner product is continuous. Version with `ContinuousWithinAt`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
ContinuousAt.inner_bundle (hv : ContinuousAt (fun m ↦ (v m : TotalSpace F E)) x) (hw : ContinuousAt (fun m ↦ (w m : TotalSpace F E)) x) : ContinuousAt (fun b ↦ ⟪v b, w b⟫) x
by simp only [← continuousWithinAt_univ] at hv hw ⊢ exact ContinuousWithinAt.inner_bundle hv hw
lemma
ContinuousAt.inner_bundle
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Riemannian.lean
[]
[ "ContinuousAt", "ContinuousWithinAt.inner_bundle", "continuousWithinAt_univ" ]
Given two continuous maps into the same fibers of a continuous Riemannian bundle, their inner product is continuous. Version with `ContinuousAt`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
ContinuousOn.inner_bundle (hv : ContinuousOn (fun m ↦ (v m : TotalSpace F E)) s) (hw : ContinuousOn (fun m ↦ (w m : TotalSpace F E)) s) : ContinuousOn (fun b ↦ ⟪v b, w b⟫) s
fun x hx ↦ (hv x hx).inner_bundle (hw x hx)
lemma
ContinuousOn.inner_bundle
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Riemannian.lean
[]
[ "ContinuousOn" ]
Given two continuous maps into the same fibers of a continuous Riemannian bundle, their inner product is continuous. Version with `ContinuousOn`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Continuous.inner_bundle (hv : Continuous (fun m ↦ (v m : TotalSpace F E))) (hw : Continuous (fun m ↦ (w m : TotalSpace F E))) : Continuous (fun b ↦ ⟪v b, w b⟫)
by simp only [continuous_iff_continuousAt] at hv hw ⊢ exact fun x ↦ (hv x).inner_bundle (hw x)
lemma
Continuous.inner_bundle
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Riemannian.lean
[]
[ "Continuous", "continuous_iff_continuousAt" ]
Given two continuous maps into the same fibers of a continuous Riemannian bundle, their inner product is continuous.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
eventually_norm_symmL_trivializationAt_self_comp_lt (x : B) {r : ℝ} (hr : 1 < r) : ∀ᶠ y in 𝓝 x, ‖((trivializationAt F E x).symmL ℝ x) ∘L ((trivializationAt F E x).continuousLinearMapAt ℝ y)‖ < r
by /- We will expand the definition of continuity of the inner product structure, in the chart. Denote `g' x` the metric in the fiber of `x`, read in the chart. For `y` close to `x`, then `g' y` and `g' x` are close. The inequality we have to prove reduces to comparing `g' y w w` and `g' x w w`, where `w` is th...
lemma
eventually_norm_symmL_trivializationAt_self_comp_lt
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Riemannian.lean
[]
[ "ContinuousAt", "Metric.continuousAt_iff'", "Real.le_norm_self", "Set.mem_univ", "continuousAt_hom_bundle", "div_eq_inv_mul", "exists_between", "inCoordinates_apply_eq₂", "inv_le_of_inv_le₀", "inv_lt_one_of_one_lt₀", "le_div_iff₀'", "le_of_sq_le_sq", "lt_of_le_of_lt", "mul_assoc", "mul_p...
In a continuous Riemannian bundle, local changes of coordinates given by the trivialization at a point distort the norm by a factor arbitrarily close to 1.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
eventually_norm_trivializationAt_lt (x : B) : ∃ C > 0, ∀ᶠ y in 𝓝 x, ‖(trivializationAt F E x).continuousLinearMapAt ℝ y‖ < C
by refine ⟨(1 + ‖(trivializationAt F E x).continuousLinearMapAt ℝ x‖) * 2, by positivity, ?_⟩ filter_upwards [eventually_norm_symmL_trivializationAt_self_comp_lt F E x one_lt_two] with y hy have A : ((trivializationAt F E x).continuousLinearMapAt ℝ x) ∘L ((trivializationAt F E x).symmL ℝ x) = ContinuousLin...
lemma
eventually_norm_trivializationAt_lt
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Riemannian.lean
[]
[ "ContinuousLinearMap.id", "eventually_norm_symmL_trivializationAt_self_comp_lt", "one_lt_two" ]
In a continuous Riemannian bundle, the trivialization at a point is locally bounded in norm.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
eventually_norm_symmL_trivializationAt_comp_self_lt (x : B) {r : ℝ} (hr : 1 < r) : ∀ᶠ y in 𝓝 x, ‖((trivializationAt F E x).symmL ℝ y) ∘L ((trivializationAt F E x).continuousLinearMapAt ℝ x)‖ < r
by /- We will expand the definition of continuity of the inner product structure, in the chart. Denote `g' x` the metric in the fiber of `x`, read in the chart. For `y` close to `x`, then `g' y` and `g' x` are close. The inequality we have to prove reduces to comparing `g' y w w` and `g' x w w`, where `w` is th...
lemma
eventually_norm_symmL_trivializationAt_comp_self_lt
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Riemannian.lean
[]
[ "ContinuousAt", "LinearMap.id_coe", "Metric.continuousAt_iff'", "Real.le_norm_self", "Set.mem_univ", "continuousAt_hom_bundle", "exists_between", "inCoordinates_apply_eq₂", "le_of_sq_le_sq", "mul_assoc", "mul_pow", "pow_two", "real_inner_self_eq_norm_sq", "self_mem_nhdsWithin", "symm", ...
In a continuous Riemannian bundle, local changes of coordinates given by the trivialization at a point distort the norm by a factor arbitrarily close to 1.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
eventually_norm_symmL_trivializationAt_lt (x : B) : ∃ C > 0, ∀ᶠ y in 𝓝 x, ‖(trivializationAt F E x).symmL ℝ y‖ < C
by refine ⟨2 * (1 + ‖(trivializationAt F E x).symmL ℝ x‖), by positivity, ?_⟩ filter_upwards [eventually_norm_symmL_trivializationAt_comp_self_lt F E x one_lt_two] with y hy have A : ((trivializationAt F E x).continuousLinearMapAt ℝ x) ∘L ((trivializationAt F E x).symmL ℝ x) = ContinuousLinearMap.id _ _ := ...
lemma
eventually_norm_symmL_trivializationAt_lt
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Riemannian.lean
[]
[ "ContinuousLinearMap.id", "eventually_norm_symmL_trivializationAt_comp_self_lt", "one_lt_two" ]
In a continuous Riemannian bundle, the inverse of the trivialization at a point is locally bounded in norm.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
RiemannianMetric where /-- The inner product along the fibers of the bundle. -/ inner (b : B) : E b →L[ℝ] E b →L[ℝ] ℝ symm (b : B) (v w : E b) : inner b v w = inner b w v pos (b : B) (v : E b) (hv : v ≠ 0) : 0 < inner b v v /-- The continuity at `0` is automatic when `E b` is isomorphic to a normed space, but...
structure
Bundle.RiemannianMetric
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Riemannian.lean
[]
[ "ContinuousAt", "symm" ]
A family of inner product space structures on the fibers of a fiber bundle, defining the same topology as the already existing one. This family is not assumed to be continuous or smooth: to guarantee continuity, resp. smoothness, of the inner product as a function of the base point, use `ContinuousRiemannianMetric` or ...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
RiemannianMetric.toCore (g : RiemannianMetric E) (b : B) : InnerProductSpace.Core ℝ (E b)
where inner v w := g.inner b v w conj_inner_symm v w := g.symm b w v re_inner_nonneg v := by rcases eq_or_ne v 0 with rfl | hv · simp · simpa using (g.pos b v hv).le add_left v w x := by simp smul_left c v := by simp definite v h := by contrapose! h; exact (g.pos b v h).ne'
def
Bundle.RiemannianMetric.toCore
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Riemannian.lean
[]
[ "InnerProductSpace.Core", "eq_or_ne" ]
`Core` structure associated to a family of inner products on the fibers of a fiber bundle. This is an auxiliary construction to endow the fibers with an inner product space structure without creating diamonds. Warning: Do not use this `Core` structure if the space you are interested in already has a norm instance defi...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
RiemannianBundle where /-- The family of inner products on the fibers -/ g : RiemannianMetric E
class
Bundle.RiemannianBundle
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Riemannian.lean
[]
[]
Class used to create an inner product structure space on the fibers of a fiber bundle, without creating diamonds. Use as follows: * `instance : RiemannianBundle E := ⟨g⟩` where `g : RiemannianMetric E` registers the inner product space on the fibers; * `instance : RiemannianBundle E := ⟨g.toRiemannianMetric⟩` where ...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
ContinuousRiemannianMetric where /-- The inner product along the fibers of the bundle. -/ inner (b : B) : E b →L[ℝ] E b →L[ℝ] ℝ symm (b : B) (v w : E b) : inner b v w = inner b w v pos (b : B) (v : E b) (hv : v ≠ 0) : 0 < inner b v v isVonNBounded (b : B) : IsVonNBounded ℝ {v : E b | inner b v v < 1} contin...
structure
Bundle.ContinuousRiemannianMetric
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Riemannian.lean
[]
[ "Continuous", "symm" ]
A family of inner product space structures on the fibers of a fiber bundle, defining the same topology as the already existing one, and varying continuously with the base point. See also `ContMDiffRiemannianMetric` for a smooth version. This structure is used through `RiemannianBundle` for typeclass inference, to regi...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
ContinuousRiemannianMetric.toRiemannianMetric (g : ContinuousRiemannianMetric F E) : RiemannianMetric E
where inner := g.inner symm := g.symm pos := g.pos isVonNBounded := g.isVonNBounded continuousAt b := by -- Continuity of bilinear maps is only true on normed spaces. As `F` is a normed space by -- assumption, we transfer everything to `F` and argue there. let e : E b ≃L[ℝ] F := Trivialization.con...
def
Bundle.ContinuousRiemannianMetric.toRiemannianMetric
Topology.VectorBundle
Mathlib/Topology/VectorBundle/Riemannian.lean
[]
[ "ContinuousLinearEquiv.refl", "symm" ]
A continuous Riemannian metric is in particular a Riemannian metric.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
elabOptAttrArg : TSyntax ``optAttrArg → TermElabM (Array Attribute)
| `(optAttrArg| (attr := $[$attrs],*)) => elabAttrs attrs | _ => pure #[]
def
Mathlib.Tactic.elabOptAttrArg
Util
Mathlib/Util/AddRelatedDecl.lean
[]
[]
Elaborate an `(attr := ...)` argument.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
addRelatedDecl (src tgt : Name) (ref : Syntax) (attrs : TSyntax ``optAttrArg) (construct : Expr → List Name → MetaM (Expr × List Name)) (docstringPrefix? : Option String := none) (hoverInfo : Bool := false) : MetaM Unit
do addDeclarationRangesFromSyntax tgt (← getRef) ref let info ← withoutExporting <| getConstInfo src let value := .const src (info.levelParams.map mkLevelParam) let (newValue, newLevels) ← construct value info.levelParams let newValue ← instantiateMVars newValue let newType ← instantiateMVars (← inferType n...
def
Mathlib.Tactic.addRelatedDecl
Util
Mathlib/Util/AddRelatedDecl.lean
[]
[]
A helper function for constructing a related declaration from an existing one. This is currently used by the attributes `reassoc` and `elementwise`, and has been factored out to avoid code duplication. Feel free to add features as needed for other applications. This helper: * calls `addDeclarationRangesFromSyntax`, s...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
"assert_no_sorry " n:ident : command => do let name ← liftCoreM <| Lean.Elab.realizeGlobalConstNoOverloadWithInfo n let axioms ← Lean.collectAxioms name if axioms.contains ``sorryAx then throwError "{n} contains sorry"
elab
assert_no_sorry
Util
Mathlib/Util/AssertNoSorry.lean
[]
[]
Throws an error if the given identifier uses sorryAx.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Lean.Elab.Tactic.withNondepPropLocation (loc : Location) (atLocal : FVarId → TacticM Unit) (atTarget : TacticM Unit) (failed : MVarId → TacticM Unit) : TacticM Unit
do match loc with | Location.targets hyps target => do (← getFVarIds hyps).forM atLocal if target then atTarget | Location.wildcard => do let mut worked := false for hyp in ← (← getMainGoal).getNondepPropHyps do worked := worked || (← tryTactic <| atLocal hyp) unless worked || (← tryTact...
def
Lean.Elab.Tactic.withNondepPropLocation
Util
Mathlib/Util/AtLocation.lean
[]
[]
Runs the given `atLocal` and `atTarget` methods on each of the locations selected by the given `loc`. * If `loc` is a list of locations, runs at each specified hypothesis (and finally the goal if `⊢` is included), and fails if any of the tactic applications fail. * If `loc` is `*`, runs at the nondependent `Prop` hyp...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
BehaviorIfUnchanged where /-- Stay silent if this action has no effect. -/ | silent /-- Log a warning if this action has no effect. -/ | warning /-- Throw an error if this action has no effect. -/ | error deriving BEq, Inhabited, Repr
inductive
Mathlib.Tactic.BehaviorIfUnchanged
Util
Mathlib/Util/AtLocation.lean
[]
[]
Different settings of communicating about a tactic which made no progress: do nothing (keep silent), print a warning or throw an error.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
transformAtTarget (m : Expr → ReaderT Simp.Context MetaM Simp.Result) (proc : String) (ifUnchanged : BehaviorIfUnchanged) (goal : MVarId) : ReaderT Simp.Context MetaM (Option MVarId)
do let tgt ← instantiateMVars (← goal.getType) let r ← m tgt -- we use expression equality here (rather than defeq) to be consistent with, e.g., -- `applySimpResultToTarget` let unchanged := tgt.cleanupAnnotations == r.expr.cleanupAnnotations if unchanged then match ifUnchanged with | .warning => lo...
def
Mathlib.Tactic.transformAtTarget
Util
Mathlib/Util/AtLocation.lean
[]
[]
Use the procedure `m` to rewrite the provided goal. Assumes `proc` is not surrounded by backticks.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
transformAtLocalDecl (m : Expr → ReaderT Simp.Context MetaM Simp.Result) (proc : String) (ifUnchanged : BehaviorIfUnchanged) (mayCloseGoal : Bool) (fvarId : FVarId) (goal : MVarId) : ReaderT Simp.Context MetaM (Option MVarId)
do let ldecl ← fvarId.getDecl if ldecl.isImplementationDetail then throwError "Cannot run `{proc}` at `{Expr.fvar fvarId}`, it is an implementation detail" let tgt ← instantiateMVars (← fvarId.getType) let eraseFVarId (ctx : Simp.Context) := ctx.setSimpTheorems <| ctx.simpTheorems.eraseTheorem (.fvar fv...
def
Mathlib.Tactic.transformAtLocalDecl
Util
Mathlib/Util/AtLocation.lean
[]
[]
Use the procedure `m` to rewrite hypothesis `fvarId`. The `simpTheorems` of the simp-context carried with `m` will be modified to remove `fvarId`; this ensures that if the procedure `m` involves rewriting by this `SimpTheoremsArray`, then, e.g., `h : x = y` is not transformed (by rewriting `h`) to `True`. Assumes `pr...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
transformAtLocation (m : Expr → ReaderT Simp.Context MetaM Simp.Result) (proc : String) (loc : Location) (ifUnchanged : BehaviorIfUnchanged := .error) (mayCloseGoalFromHyp : Bool := false) -- streamline the most common use case, in which the procedure `m`'s implementation is not -- simp-based and its `S...
withLocation loc (liftMetaTactic1 ∘ (transformAtLocalDecl m proc ifUnchanged mayCloseGoalFromHyp · · ctx)) (liftMetaTactic1 (transformAtTarget m proc ifUnchanged · ctx)) fun _ ↦ throwError "`{proc}` made no progress anywhere"
def
Mathlib.Tactic.transformAtLocation
Util
Mathlib/Util/AtLocation.lean
[]
[]
Use the procedure `m` to transform at specified locations (hypotheses and/or goal). Assumes `proc` is not surrounded by backticks.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
transformAtNondepPropLocation (m : Expr → ReaderT Simp.Context MetaM Simp.Result) (proc : String) (loc : Location) (ifUnchanged : BehaviorIfUnchanged := .error) (mayCloseGoalFromHyp : Bool := false) -- streamline the most common use case, in which the procedure `m`'s implementation is not -- simp-based ...
withNondepPropLocation loc (liftMetaTactic1 ∘ (transformAtLocalDecl m proc ifUnchanged mayCloseGoalFromHyp · · ctx)) (liftMetaTactic1 (transformAtTarget m proc ifUnchanged · ctx)) fun _ ↦ throwError "`{proc}` made no progress anywhere"
def
Mathlib.Tactic.transformAtNondepPropLocation
Util
Mathlib/Util/AtLocation.lean
[]
[]
Use the procedure `m` to transform at specified locations (hypotheses and/or goal). In the wildcard case (`*`), filter out all dependent and/or non-`Prop` hypotheses. Assumes `proc` is not surrounded by backticks.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
AtomM.Context where /-- The reducibility setting for definitional equality of atoms -/ red : TransparencyMode /-- A simplification to apply to atomic expressions when they are encountered, before interning them in the atom list. -/ evalAtom : Expr → MetaM Simp.Result
fun e ↦ pure { expr := e } deriving Inhabited
structure
Mathlib.Tactic.AtomM.Context
Util
Mathlib/Util/AtomM.lean
[]
[]
The context (read-only state) of the `AtomM` monad.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
AtomM.State where /-- The list of atoms-up-to-defeq encountered thus far, used for atom sorting. -/ atoms : Array Expr
#[]
structure
Mathlib.Tactic.AtomM.State
Util
Mathlib/Util/AtomM.lean
[]
[]
The mutable state of the `AtomM` monad.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
AtomM
ReaderT AtomM.Context <| StateRefT AtomM.State MetaM
abbrev
Mathlib.Tactic.AtomM
Util
Mathlib/Util/AtomM.lean
[]
[]
The monad that `ring` works in. This is only used for collecting atoms.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
AtomM.run {α : Type} (red : TransparencyMode) (m : AtomM α) (evalAtom : Expr → MetaM Simp.Result := fun e ↦ pure { expr := e }) : MetaM α
(m { red, evalAtom }).run' {}
def
Mathlib.Tactic.AtomM.run
Util
Mathlib/Util/AtomM.lean
[]
[]
Run a computation in the `AtomM` monad.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
isDefEqSafe (a b : Expr) : MetaM Bool
try isDefEq a b catch _ => pure false
def
Mathlib.Tactic.isDefEqSafe
Util
Mathlib/Util/AtomM.lean
[]
[]
A safe version of `isDefEq` that doesn't throw errors. We use it to avoid "unknown free variable `_fvar.102937`" errors when there may be out-of-scope free variables. TODO: don't catch any other errors
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
AtomM.containsThenAdd (e : Expr) : AtomM (Bool × Nat × Expr)
do let c ← get for h : i in [:c.atoms.size] do if ← withTransparency (← read).red <| isDefEqSafe e c.atoms[i] then return (true, i, c.atoms[i]) modifyGet fun c ↦ ((false, c.atoms.size, e), { c with atoms := c.atoms.push e })
def
Mathlib.Tactic.AtomM.containsThenAdd
Util
Mathlib/Util/AtomM.lean
[]
[]
If an atomic expression has already been encountered, return `true`, the index and the stored form of the atom (which will be defeq at the specified transparency, but not necessarily syntactically equal). If the atomic expression has *not* already been encountered, store it in the list of atoms, and return the new inde...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
AtomM.containsThenAddQ {u : Level} {α : Q(Type u)} (e : Q($α)) : AtomM (Bool × Nat × {e' : Q($α) // $e =Q $e'})
do let (b, n, e') ← AtomM.containsThenAdd e return (b, n, ⟨e', ⟨⟩⟩)
def
Mathlib.Tactic.AtomM.containsThenAddQ
Util
Mathlib/Util/AtomM.lean
[]
[]
If an atomic expression has already been encountered, return `true`, the index and the stored form of the atom (which will be defeq at the specified transparency, but not necessarily syntactically equal). If the atomic expression has *not* already been encountered, store it in the list of atoms, and return the new inde...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
AtomM.addAtom (e : Expr) : AtomM (Nat × Expr)
Prod.snd <$> AtomM.containsThenAdd e
def
Mathlib.Tactic.AtomM.addAtom
Util
Mathlib/Util/AtomM.lean
[]
[]
If an atomic expression has already been encountered, get the index and the stored form of the atom (which will be defeq at the specified transparency, but not necessarily syntactically equal). If the atomic expression has *not* already been encountered, store it in the list of atoms, and return the new index (and the ...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
AtomM.addAtomQ {u : Level} {α : Q(Type u)} (e : Q($α)) : AtomM (Nat × {e' : Q($α) // $e =Q $e'})
do let (n, e') ← AtomM.addAtom e return (n, ⟨e', ⟨⟩⟩)
def
Mathlib.Tactic.AtomM.addAtomQ
Util
Mathlib/Util/AtomM.lean
[]
[]
If an atomic expression has already been encountered, get the index and the stored form of the atom (which will be defeq at the specified transparency, but not necessarily syntactically equal). If the atomic expression has *not* already been encountered, store it in the list of atoms, and return the new index (and the ...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
replaceConst (repl : AssocList Name Name) (e : Expr) : Expr
e.replace fun | .const n us => repl.find? n |>.map (.const · us) | _ => none
def
Mathlib.Util.replaceConst
Util
Mathlib/Util/CompileInductive.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
mkRecNames (all : List Name) (numMotives : Nat) : List Name
if numMotives ≤ all.length then all.map mkRecName else let main := all[0]! all.map mkRecName ++ (List.range (numMotives - all.length)).map (fun i => main.str s!"rec_{i+1}")
def
Mathlib.Util.mkRecNames
Util
Mathlib/Util/CompileInductive.lean
[]
[]
Returns the names of the recursors for a nested or mutual inductive, using the `all` and `numMotives` arguments from `RecursorVal`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
addAndCompile' (decl : Declaration) : CoreM Unit
do try addAndCompile decl catch e => match decl with | .defnDecl val => throwError "while compiling {val.name}: {e.toMessageData}" | .mutualDefnDecl val => throwError "while compiling {val.map (·.name)}: {e.toMessageData}" | _ => unreachable!
def
Mathlib.Util.addAndCompile'
Util
Mathlib/Util/CompileInductive.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
compileDefn (dv : DefinitionVal) : MetaM Unit
do if ((← getEnv).getModuleIdxFor? dv.name).isNone then -- If it's in the same module then we can safely just call `compileDecl` -- on the original definition return ← compileDecl <| .defnDecl dv let name ← mkFreshUserName dv.name addAndCompile' <| .defnDecl { dv with name } let levels := dv.levelPa...
def
Mathlib.Util.compileDefn
Util
Mathlib/Util/CompileInductive.lean
[]
[]
Compile the definition `dv` by adding a second definition `dv✝` with the same body, and registering a `csimp`-lemma `dv = dv✝`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
hasCSimpLemma (env : Environment) (n : Name) : Bool
(Compiler.CSimp.ext.getState env).map.contains n
def
Mathlib.Util.hasCSimpLemma
Util
Mathlib/Util/CompileInductive.lean
[]
[]
Returns true if the given declaration has a `@[csimp]` lemma.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
tk:"compile_def% " i:ident : command => Command.liftTermElabM do let n ← realizeGlobalConstNoOverloadWithInfo i if hasCSimpLemma (← getEnv) n then logWarningAt tk m!"already compiled {n}" return let dv ← withRef i <| getConstInfoDefn n withRef tk <| compileDefn dv
elab
compile_def%
Util
Mathlib/Util/CompileInductive.lean
[]
[]
`compile_def% Foo.foo` adds compiled code for the definition `Foo.foo`. This can be used for type class projections or definitions like `List._sizeOf_1`, for which Lean does not generate compiled code by default (since it is not used 99% of the time).
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
compileStructOnly (iv : InductiveVal) (rv : RecursorVal) : MetaM Unit
do let value ← forallTelescope rv.type fun xs _ => let val := xs[rv.getFirstMinorIdx]! let val := mkAppN val ⟨.map (xs[rv.getMajorIdx]!.proj iv.name) <| .range rv.rules[0]!.nfields⟩ mkLambdaFVars xs val go value where go value := do let name ← mkFreshUserName rv.name addAndCompile' <| .defnDec...
def
Mathlib.Util.compileStructOnly
Util
Mathlib/Util/CompileInductive.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
compileInductiveOnly (iv : InductiveVal) (rv : RecursorVal) (warn := true) : MetaM Unit
do if ← isProp rv.type then if warn then logWarning m!"not compiling {rv.name}" return if !iv.isRec && rv.numMotives == 1 && iv.numCtors == 1 && iv.numIndices == 0 then compileStructOnly iv rv return let levels := rv.levelParams.map .param let rvs ← if rv.numMotives == 1 then pure [rv] e...
def
Mathlib.Util.compileInductiveOnly
Util
Mathlib/Util/CompileInductive.lean
[]
[ "aux" ]
Generate compiled code for the recursor for `iv`, excluding the `sizeOf` function.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
compileInductive (iv : InductiveVal) (warn := true) : MetaM Unit
do let rv ← getConstInfoRec <| mkRecName iv.name if hasCSimpLemma (← getEnv) rv.name then if warn then logWarning m!"already compiled {rv.name}" return compileInductiveOnly iv rv warn compileSizeOf iv rv
def
Mathlib.Util.compileInductive
Util
Mathlib/Util/CompileInductive.lean
[]
[]
Generate compiled code for the recursor for `iv`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
compileSizeOf (iv : InductiveVal) (rv : RecursorVal) : MetaM Unit
do let go aux := do if let some (.defnInfo dv) := (← getEnv).find? aux then if !hasCSimpLemma (← getEnv) aux then let deps : NameSet := dv.value.foldConsts ∅ fun c arr => if let .str name "_sizeOf_inst" := c then arr.insert name else arr for i in deps do -- We only want t...
def
Mathlib.Util.compileSizeOf
Util
Mathlib/Util/CompileInductive.lean
[]
[ "aux" ]
Compiles the `sizeOf` auxiliary functions. It also recursively compiles any inductives required to compile the `sizeOf` definition (because `sizeOf` definitions depend on `T.rec`).
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
tk:"compile_inductive% " i:ident : command => Command.liftTermElabM do let n ← realizeGlobalConstNoOverloadWithInfo i let iv ← withRef i <| getConstInfoInduct n withRef tk <| compileInductive iv
elab
compile_inductive%
Util
Mathlib/Util/CompileInductive.lean
[]
[]
`compile_inductive% Foo` creates compiled code for the recursor `Foo.rec`, so that `Foo.rec` can be used in a definition without having to mark the definition as `noncomputable`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Float.valUnsafe : Float → floatSpec.float
unsafeCast
def
Float.valUnsafe
Util
Mathlib/Util/CompileInductive.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Float.mkUnsafe : floatSpec.float → Float
unsafeCast
def
Float.mkUnsafe
Util
Mathlib/Util/CompileInductive.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Float.valImpl (x : Float) : floatSpec.float
x.1
def
Float.valImpl
Util
Mathlib/Util/CompileInductive.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Float.mkImpl (x : floatSpec.float) : Float
⟨x⟩
def
Float.mkImpl
Util
Mathlib/Util/CompileInductive.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Float.val_eq : @Float.val = Float.valImpl
rfl
theorem
Float.val_eq
Util
Mathlib/Util/CompileInductive.lean
[]
[ "Float.valImpl" ]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Float.mk_eq : @Float.mk = Float.mkImpl
rfl
theorem
Float.mk_eq
Util
Mathlib/Util/CompileInductive.lean
[]
[ "Float.mkImpl" ]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
runTacForHeartbeats (tac : TSyntax `Lean.Parser.Tactic.tacticSeq) (revert : Bool := true) : TacticM Nat
do let start ← IO.getNumHeartbeats let s ← saveState withOptions (fun opts => opts.set ``Elab.async false) do evalTactic tac if revert then restoreState s return (← IO.getNumHeartbeats) - start
def
Mathlib.CountHeartbeats.runTacForHeartbeats
Util
Mathlib/Util/CountHeartbeats.lean
[]
[]
Run a tactic, optionally restoring the original state, and report just the number of heartbeats.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
variation (counts : List Nat) : List Nat
let min := counts.min?.getD 0 let max := counts.max?.getD 0 let toFloat (n : Nat) := n.toUInt64.toFloat let toNat (f : Float) := f.toUInt64.toNat let counts' := counts.map toFloat let μ : Float := counts'.foldl (· + ·) 0 / toFloat counts.length let stddev : Float := Float.sqrt <| ((counts'.map fun i => ...
def
Mathlib.CountHeartbeats.variation
Util
Mathlib/Util/CountHeartbeats.lean
[]
[ "toNat" ]
Given a `List Nat`, return the minimum, maximum, and standard deviation.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
logVariation {m} [Monad m] [MonadLog m] [AddMessageContext m] [MonadOptions m] (counts : List Nat) : m Unit
do if let [min, max, stddev] := variation counts then -- convert `[min, max, stddev]` to user-facing heartbeats logInfo s!"Min: {min / 1000} Max: {max / 1000} StdDev: {stddev / 10}%"
def
Mathlib.CountHeartbeats.logVariation
Util
Mathlib/Util/CountHeartbeats.lean
[]
[]
Given a `List Nat`, log an info message with the minimum, maximum, and standard deviation.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
"#count_heartbeats " tac:tacticSeq : tactic => do logInfo s!"{← runTacForHeartbeats tac (revert := false)}"
elab
#count_heartbeats
Util
Mathlib/Util/CountHeartbeats.lean
[]
[]
`#count_heartbeats tac` counts the heartbeats used by the tactic sequence `tac` and prints an info line with the number of heartbeats. * `#count_heartbeats! n in tac`, where `n` is an optional natural number literal, runs `tac` `n` times on the same goal while counting the heartbeats, and prints an info line with ra...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
"#count_heartbeats! " n:(num)? "in" ppLine tac:tacticSeq : tactic => do let n
match n with | some j => j.getNat | none => 10 -- First run the tactic `n-1` times, reverting the state. let counts ← (List.range (n - 1)).mapM fun _ => runTacForHeartbeats tac -- Then run once more, keeping the state. let counts := (← runTacForHeartbeats tac (revert := false)) :: counts ...
elab
#count_heartbeats!
Util
Mathlib/Util/CountHeartbeats.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
roundDownIf (n : Nat) (approx : Bool) : String
if approx then s!"approximately {(n / 1000) * 1000}" else s!"{n}"
def
Mathlib.CountHeartbeats.roundDownIf
Util
Mathlib/Util/CountHeartbeats.lean
[]
[]
Round down the number `n` to the nearest thousand, if `approx` is `true`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
"#count_heartbeats " approx:(&"approximately ")? "in" ppLine cmd:command : command => do let start ← IO.getNumHeartbeats try elabCommand (← `(command| set_option maxHeartbeats 0 in $cmd)) finally let finish ← IO.getNumHeartbeats let elapsed
(finish - start) / 1000 let roundElapsed := roundDownIf elapsed approx.isSome let max := (← Command.liftCoreM getMaxHeartbeats) / 1000 if elapsed < max then logInfo m!"Used {roundElapsed} heartbeats, which is less than the current maximum of {max}." else let mut max' := max whi...
elab
#count_heartbeats
Util
Mathlib/Util/CountHeartbeats.lean
[]
[]
`#count_heartbeats in cmd` counts the heartbeats used in the enclosed command `cmd`. Use `#count_heartbeats` to count the heartbeats in *all* the following declarations. This is most useful for setting sufficient but reasonable limits via `set_option maxHeartbeats` for long-running declarations. If you do so, please ...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
"guard_min_heartbeats " approx:(&"approximately ")? n:(num)? "in" ppLine cmd:command : command => do let max
(← Command.liftCoreM getMaxHeartbeats) / 1000 let n := match n with | some j => j.getNat | none => max let start ← IO.getNumHeartbeats try elabCommand (← `(command| set_option Elab.async false in set_option maxHeartbeats 0 in $cmd)) finally let finish ← IO.getNumHeartbeats let ...
elab
guard_min_heartbeats
Util
Mathlib/Util/CountHeartbeats.lean
[]
[]
Guard the minimal number of heartbeats used in the enclosed command. This is most useful in the context of debugging and minimizing an example of a slow declaration. By guarding the number of heartbeats used in the slow declaration, an error message will be generated if a minimization step makes the slow behaviour go ...
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
elabForHeartbeats (cmd : TSyntax `command) (revert : Bool := true) : CommandElabM Nat
do let start ← IO.getNumHeartbeats let s ← get elabCommand (← `(command| set_option maxHeartbeats 0 in $cmd)) if revert then set s return (← IO.getNumHeartbeats) - start
def
Mathlib.CountHeartbeats.elabForHeartbeats
Util
Mathlib/Util/CountHeartbeats.lean
[]
[]
Run a command, optionally restoring the original state, and report just the number of heartbeats.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
"#count_heartbeats! " n:(num)? "in" ppLine cmd:command : command => do let n
match n with | some j => j.getNat | none => 10 -- First run the command `n-1` times, reverting the state. let counts ← (List.range (n - 1)).mapM fun _ => elabForHeartbeats cmd -- Then run once more, keeping the state. let counts := (← elabForHeartbeats cmd (revert := false)) :: counts lo...
elab
#count_heartbeats!
Util
Mathlib/Util/CountHeartbeats.lean
[]
[]
`#count_heartbeats! in cmd` runs a command `10` times, reporting the range in heartbeats, and the standard deviation. The command `#count_heartbeats! n in cmd` runs it `n` times instead. Example usage: ``` #count_heartbeats! in def f := 37 ``` displays the info message `Min: 7 Max: 8 StdDev: 14%`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
countHeartbeatsLinter : Linter
where run := withSetOptionIn fun stx ↦ do unless getLinterValue linter.countHeartbeats (← getLinterOptions) do return if (← get).messages.hasErrors then return let mut msgs := #[] if [``Lean.Parser.Command.declaration, `lemma].contains stx.getKind then let s ← get if getLinterValue linter.countH...
def
Mathlib.Linter.CountHeartbeats.countHeartbeatsLinter
Util
Mathlib/Util/CountHeartbeats.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
"#count_heartbeats" approx:(&" approximately")? : command => do let approx ← if approx.isSome then `(set_option linter.countHeartbeatsApprox true) else `(set_option linter.countHeartbeatsApprox false) return ⟨mkNullNode #[← `(command| set_option linter.countHeartbeats true), approx]⟩
macro
#count_heartbeats
Util
Mathlib/Util/CountHeartbeats.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
Lean.Meta.isCanonicalInstance (inst : Expr) : MetaM Bool
do let type ← inferType inst let .some synthInst ← trySynthInstance type | return false isDefEqI inst synthInst
def
Lean.Meta.isCanonicalInstance
Util
Mathlib/Util/DelabNonCanonical.lean
[]
[]
Returns `true` iff the given instance is defeq to the instance synthesized for its type, and returns `false` otherwise (including if instance synthesis fails).
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
delabCheckingCanonical : DelabM (Bool × Term)
do let inst ← getExpr if ← isCanonicalInstance inst then return (true, ← withAnnotateTermInfo `(_)) else return (false, ← delab)
def
delabCheckingCanonical
Util
Mathlib/Util/DelabNonCanonical.lean
[]
[]
When the delab reader is pointed at an expression for an instance, returns `(true, t)` iff instance synthesis succeeds and produces a defeq instance; otherwise returns `(false, t)`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
delabUnary (arity arg : Nat) (mkStx : Term → Delab) : Delab
whenPPOption Lean.getPPNotation <| whenNotPPOption getPPExplicit <| withOverApp arity <| do let (false, instD) ← withNaryArg arg delabCheckingCanonical | failure mkStx instD
def
Delab.Noncanonical.delabUnary
Util
Mathlib/Util/DelabNonCanonical.lean
[]
[ "delabCheckingCanonical" ]
Delaborate an expression with arity `arity` into a unary notation `mkStx` iff the argument `arg` is a non-canonical instance (is not defeq to what is synthesized for its type, or else instance synthesis fails).
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
delabBinary (arity arg₁ arg₂ : Nat) (mkStx : Term → Term → DelabM Term) : Delab
whenPPOption Lean.getPPNotation <| whenNotPPOption getPPExplicit <| withOverApp arity <| do let (canonα?, instDα) ← withNaryArg arg₁ delabCheckingCanonical let (canonβ?, instDβ) ← withNaryArg arg₂ delabCheckingCanonical if canonα? && canonβ? then failure mkStx instDα instDβ
def
Delab.Noncanonical.delabBinary
Util
Mathlib/Util/DelabNonCanonical.lean
[]
[ "delabCheckingCanonical" ]
Delaborate an expression with arity `arity` into a binary notation `mkStx` iff either argument `arg₁` or `arg₂` are non-canonical instances (are not defeq to what is synthesized for its type, or else instance synthesis fails).
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
piNotation
leading_parser:leadPrec unicodeSymbol "Π" "PiType" >> many1 (ppSpace >> (binderIdent <|> bracketedBinder)) >> optType >> ", " >> termParser
def
PiNotation.piNotation
Util
Mathlib/Util/Delaborators.lean
[]
[]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
replacePiNotation : Lean.Macro
| .node info _ args => return .node info ``Lean.Parser.Term.forall args | _ => Lean.Macro.throwUnsupported
def
PiNotation.replacePiNotation
Util
Mathlib/Util/Delaborators.lean
[]
[]
Since pi notation and forall notation are interchangeable, we can parse it by simply using the pre-existing forall parser.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
delabPi : Delab
whenPPOption getPPBinderPredicates <| whenPPOption Lean.getPPNotation do let stx ← delabForall match stx with | `(∀ ($i:ident : $_), $j:ident ∈ $s → $body) => if i == j then `(∀ $i:ident ∈ $s, $body) else pure stx | `(∀ ($x:ident : $_), $y:ident > $z → $body) => if x == y then `(∀ $x:ident > $z, $body) ...
def
PiNotation.delabPi
Util
Mathlib/Util/Delaborators.lean
[]
[]
Override the Lean 4 pi notation delaborator with one that prints cute binders such as `∀ ε > 0`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
delabPi' : Delab
whenPPOption Lean.getPPNotation do -- Use delabForall as a backup if `pp.mathlib.binderPredicates` is false. let stx ← delabPi <|> delabForall -- Replacements let stx : Term ← match stx with | `($group:bracketedBinder → $body) => `(Π $group:bracketedBinder, $body) | _ => pure stx -- Merging matc...
def
PiNotation.delabPi'
Util
Mathlib/Util/Delaborators.lean
[]
[]
Override the Lean 4 pi notation delaborator with one that uses `Π` and prints cute binders such as `∀ ε > 0`. Note that this takes advantage of the fact that `(x : α) → p x` notation is never used for propositions, so we can match on this result and rewrite it.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
exists_delab : Delab
whenPPOption Lean.getPPNotation do let #[ι, f] := (← SubExpr.getExpr).getAppArgs | failure unless f.isLambda do failure let prop ← Meta.isProp ι let dep := f.bindingBody!.hasLooseBVar 0 let ppTypes ← getPPOption getPPFunBinderTypes let stx ← SubExpr.withAppArg do let dom ← SubExpr.withBindingDomain dela...
def
exists_delab
Util
Mathlib/Util/Delaborators.lean
[]
[ "Mathlib.getPPBinderPredicates" ]
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
delabNotIn
whenPPOption Lean.getPPNotation do let #[f] := (← SubExpr.getExpr).getAppArgs | failure guard <| f.isAppOfArity ``Membership.mem 5 let stx₁ ← SubExpr.withAppArg <| SubExpr.withNaryArg 3 delab let stx₂ ← SubExpr.withAppArg <| SubExpr.withNaryArg 4 delab return ← `($stx₂ ∉ $stx₁)
def
delabNotIn
Util
Mathlib/Util/Delaborators.lean
[]
[]
Delaborator for `∉`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319
wrapSimpDischarger (dis : Simp.Discharge) : TacticM Unit
do let eS : Lean.Meta.Simp.State := {} let eC : Lean.Meta.Simp.Context := ← Simp.mkContext {} let eM : Lean.Meta.Simp.Methods := {} let (some a, _) ← liftM <| StateRefT'.run (ReaderT.run (ReaderT.run (dis <| ← getMainTarget) eM.toMethodsRef) eC) eS | failure (← getMainGoal).assignIfDefEq a
def
wrapSimpDischarger
Util
Mathlib/Util/DischargerAsTactic.lean
[]
[]
Wrap a simp discharger (a function `Expr → SimpM (Option Expr)`) as a tactic, so that it can be passed as an argument to `simp (discharger := foo)`. This is inverse to `mkDischargeWrapper`.
https://github.com/leanprover-community/mathlib4
b9f14353520df73472ae3825fb53f86559a01319