fact stringlengths 6 3.84k | type stringclasses 11 values | library stringclasses 32 values | imports listlengths 1 14 | filename stringlengths 20 95 | symbolic_name stringlengths 1 90 | docstring stringlengths 7 20k ⌀ |
|---|---|---|---|---|---|---|
constructLeGraph (nVertexes : Nat) (facts : Array AtomicFact)
(idxToAtom : Std.HashMap Nat Expr) : MetaM Graph := do
let mut res : Graph := Array.replicate nVertexes #[]
for fact in facts do
if let .le lhs rhs proof := fact then
res := res.addEdge ⟨lhs, rhs, proof⟩
else if let .isTop idx := fact then
for i in [:nVertexes] do
if i != idx then
res := res.addEdge ⟨i, idx, ← mkAppOptM ``le_top #[none, none, none, idxToAtom.get! i]⟩
else if let .isBot idx := fact then
for i in [:nVertexes] do
if i != idx then
res := res.addEdge ⟨idx, i, ← mkAppOptM ``bot_le #[none, none, none, idxToAtom.get! i]⟩
return res | def | Tactic | [
"Mathlib.Tactic.Order.CollectFacts"
] | Mathlib/Tactic/Order/Graph/Basic.lean | constructLeGraph | Constructs a directed `Graph` using `≤` facts. It also creates edges from `⊥`
(if present) to all vertices and from all vertices to `⊤` (if present). |
DFSState where
/-- `visited[v] = true` if and only if the algorithm has already entered vertex `v`. -/
visited : Array Bool | structure | Tactic | [
"Mathlib.Tactic.Order.CollectFacts"
] | Mathlib/Tactic/Order/Graph/Basic.lean | DFSState | State for the DFS algorithm. |
partial buildTransitiveLeProofDFS (g : Graph) (v t : Nat) (tExpr : Expr) :
StateT DFSState MetaM (Option Expr) := do
modify fun s => {s with visited := s.visited.set! v true}
if v == t then
return ← mkAppM ``le_refl #[tExpr]
for edge in g[v]! do
let u := edge.dst
if !(← get).visited[u]! then
match ← buildTransitiveLeProofDFS g u t tExpr with
| some pf => return some <| ← mkAppM ``le_trans #[edge.proof, pf]
| none => continue
return none | def | Tactic | [
"Mathlib.Tactic.Order.CollectFacts"
] | Mathlib/Tactic/Order/Graph/Basic.lean | buildTransitiveLeProofDFS | DFS algorithm for constructing a proof that `x ≤ y` by finding a path from `x` to `y` in the
`≤`-graph. |
buildTransitiveLeProof (g : Graph) (idxToAtom : Std.HashMap Nat Expr) (s t : Nat) :
MetaM (Option Expr) := do
let state : DFSState := ⟨.replicate g.size false⟩
(buildTransitiveLeProofDFS g s t (idxToAtom.get! t)).run' state | def | Tactic | [
"Mathlib.Tactic.Order.CollectFacts"
] | Mathlib/Tactic/Order/Graph/Basic.lean | buildTransitiveLeProof | Given a `≤`-graph `g`, finds a proof of `s ≤ t` using transitivity. |
TarjanState extends DFSState where
/-- `id[v]` is the index of the vertex `v` in the DFS traversal. -/
id : Array Nat
/-- `lowlink[v]` is the smallest index of any node on the stack that is reachable from `v`
through `v`'s DFS subtree. -/
lowlink : Array Nat
/-- The stack of visited vertices used in Tarjan's algorithm. -/
stack : Array Nat
/-- `onStack[v] = true` iff `v` is in `stack`. The structure is used to check it efficiently. -/
onStack : Array Bool
/-- A time counter that increments each time the algorithm visits an unvisited vertex. -/
time : Nat | structure | Tactic | [
"Mathlib.Tactic.Order.Graph.Basic"
] | Mathlib/Tactic/Order/Graph/Tarjan.lean | TarjanState | State for Tarjan's algorithm. |
partial tarjanDFS (g : Graph) (v : Nat) : StateM TarjanState Unit := do
modify fun s => {
visited := s.visited.set! v true,
id := s.id.set! v s.time,
lowlink := s.lowlink.set! v s.time,
stack := s.stack.push v,
onStack := s.onStack.set! v true,
time := s.time + 1
}
for edge in g[v]! do
let u := edge.dst
if !(← get).visited[u]! then
tarjanDFS g u
modify fun s => {s with
lowlink := s.lowlink.set! v (min s.lowlink[v]! s.lowlink[u]!),
}
else if (← get).onStack[u]! then
modify fun s => {s with
lowlink := s.lowlink.set! v (min s.lowlink[v]! s.id[u]!),
}
if (← get).id[v]! = (← get).lowlink[v]! then
let mut w := 0
while true do
w := (← get).stack.back!
modify fun s => {s with
stack := s.stack.pop
onStack := s.onStack.set! w false
lowlink := s.lowlink.set! w s.lowlink[v]!
}
if w = v then
break | def | Tactic | [
"Mathlib.Tactic.Order.Graph.Basic"
] | Mathlib/Tactic/Order/Graph/Tarjan.lean | tarjanDFS | The Tarjan's algorithm.
See [Wikipedia](https://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm). |
findSCCsImp (g : Graph) : StateM TarjanState Unit := do
for v in [:g.size] do
if !(← get).visited[v]! then
tarjanDFS g v | def | Tactic | [
"Mathlib.Tactic.Order.Graph.Basic"
] | Mathlib/Tactic/Order/Graph/Tarjan.lean | findSCCsImp | Implementation of `findSCCs` in the `StateM TarjanState` monad. |
findSCCs (g : Graph) : Array Nat :=
let s : TarjanState := {
visited := .replicate g.size false
id := .replicate g.size 0
lowlink := .replicate g.size 0
stack := #[]
onStack := .replicate g.size false
time := 0
}
(findSCCsImp g).run s |>.snd.lowlink | def | Tactic | [
"Mathlib.Tactic.Order.Graph.Basic"
] | Mathlib/Tactic/Order/Graph/Tarjan.lean | findSCCs | Finds the strongly connected components of the graph `g`. Returns an array where the value at
index `v` represents the SCC number containing vertex `v`. The numbering of SCCs is arbitrary. |
private apply_eq_dlookup (m : List (Σ _ : α, β)) (y : β) (x : α) :
(withDefault m y).apply x = (m.dlookup x).getD y := by
dsimp only [apply]
congr 1
induction m with
| nil => simp
| cons p m ih =>
rcases p with ⟨fst, snd⟩
by_cases heq : fst = x
· simp [heq]
· rw [List.dlookup_cons_ne]
· simp [heq, ih]
· symm
simp [heq]
variable [Zero β] [DecidableEq β] | theorem | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | apply_eq_dlookup | This theorem exists because plausible does not have access to dlookup but
mathlib has all the theory for it and wants to use it. We probably want to
bring these two together at some point. |
@[simp]
zeroDefault : TotalFunction α β → TotalFunction α β
| .withDefault A _ => .withDefault A 0 | def | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | zeroDefault | Map a total_function to one whose default value is zero so that it represents a finsupp. |
@[simp]
zeroDefaultSupp : TotalFunction α β → Finset α
| .withDefault A _ =>
List.toFinset <| (A.dedupKeys.filter fun ab => Sigma.snd ab ≠ 0).map Sigma.fst | def | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | zeroDefaultSupp | The support of a zero default `TotalFunction`. |
applyFinsupp (tf : TotalFunction α β) : α →₀ β where
support := zeroDefaultSupp tf
toFun := tf.zeroDefault.apply
mem_support_toFun := by
intro a
rcases tf with ⟨A, y⟩
simp only [zeroDefaultSupp, List.mem_map, List.mem_filter, exists_and_right,
List.mem_toFinset, exists_eq_right, Sigma.exists, Ne, zeroDefault]
rw [apply_eq_dlookup]
constructor
· rintro ⟨od, hval, hod⟩
have := List.mem_dlookup (List.nodupKeys_dedupKeys A) hval
rw [(_ : List.dlookup a A = od)]
· simpa using hod
· simpa [List.dlookup_dedupKeys]
· intro h
use (A.dlookup a).getD (0 : β)
rw [← List.dlookup_dedupKeys] at h ⊢
simp only [h, ← List.mem_dlookup_iff A.nodupKeys_dedupKeys, not_false_iff, Option.mem_def]
cases haA : List.dlookup a A.dedupKeys
· simp [haA] at h
· simp
variable [SampleableExt α] [SampleableExt β] [Repr α] | def | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | applyFinsupp | Create a finitely supported function from a total function by taking the default value to
zero. |
Finsupp.sampleableExt : SampleableExt (α →₀ β) where
proxy := TotalFunction α (SampleableExt.proxy β)
interp := fun f => (f.comp SampleableExt.interp).applyFinsupp
sample := SampleableExt.sample (α := α → β)
shrink := { shrink := letI : Shrinkable α := {}; TotalFunction.shrink } | instance | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | Finsupp.sampleableExt | null |
DFinsupp.sampleableExt : SampleableExt (Π₀ _ : α, β) where
proxy := TotalFunction α (SampleableExt.proxy β)
interp := fun f => (f.comp SampleableExt.interp).applyFinsupp.toDFinsupp
sample := SampleableExt.sample (α := α → β)
shrink := { shrink := letI : Shrinkable α := {}; TotalFunction.shrink } | instance | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | DFinsupp.sampleableExt | null |
InjectiveFunction (α : Type u) : Type u
| mapToSelf (xs : List (Σ _ : α, α)) :
xs.map Sigma.fst ~ xs.map Sigma.snd → List.Nodup (xs.map Sigma.snd) → InjectiveFunction α | inductive | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | InjectiveFunction | Data structure specifying a total function using a list of pairs
and a default value returned when the input is not in the domain of
the partial function.
`mapToSelf f` encodes `x ↦ f x` when `x ∈ f` and `x ↦ x`,
i.e. `x` to itself, otherwise.
We use `Σ` to encode mappings instead of `×` because we
rely on the association list API defined in `Mathlib/Data/List/Sigma.lean`. |
apply [DecidableEq α] : InjectiveFunction α → α → α
| InjectiveFunction.mapToSelf m _ _, x => (m.dlookup x).getD x | def | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | apply | Apply a total function to an argument. |
protected repr [Repr α] : InjectiveFunction α → String
| InjectiveFunction.mapToSelf m _ _ => s! "[{TotalFunction.reprAux m}x ↦ x]" | def | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | repr | Produce a string for a given `InjectiveFunction`.
The output is of the form `[x₀ ↦ f x₀, .. xₙ ↦ f xₙ, x ↦ x]`.
Unlike for `TotalFunction`, the default value is not a constant
but the identity function. |
List.applyId [DecidableEq α] (xs : List (α × α)) (x : α) : α :=
((xs.map Prod.toSigma).dlookup x).getD x
@[simp] | def | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | List.applyId | Interpret a list of pairs as a total function, defaulting to
the identity function when no entries are found for a given function |
List.applyId_cons [DecidableEq α] (xs : List (α × α)) (x y z : α) :
List.applyId ((y, z)::xs) x = if y = x then z else List.applyId xs x := by
simp only [List.applyId, List.dlookup, eq_rec_constant, Prod.toSigma, List.map]
split_ifs <;> rfl
open Function
open List
open Nat | theorem | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | List.applyId_cons | null |
List.applyId_zip_eq [DecidableEq α] {xs ys : List α} (h₀ : List.Nodup xs)
(h₁ : xs.length = ys.length) (x y : α) (i : ℕ) (h₂ : xs[i]? = some x) :
List.applyId.{u} (xs.zip ys) x = y ↔ ys[i]? = some y := by
induction xs generalizing ys i with
| nil => cases h₂
| cons x' xs xs_ih =>
cases i
· simp only [length_cons, lt_add_iff_pos_left, add_pos_iff, Nat.lt_add_one, or_true,
getElem?_eq_getElem, getElem_cons_zero, Option.some.injEq] at h₂
subst h₂
cases ys
· cases h₁
· simp
· cases ys
· cases h₁
· obtain - | ⟨h₀, h₁⟩ := h₀
simp only [getElem?_cons_succ, zip_cons_cons, applyId_cons] at h₂ ⊢
rw [if_neg]
· apply xs_ih <;> solve_by_elim [Nat.succ.inj]
· apply h₀; apply List.mem_of_getElem? h₂ | theorem | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | List.applyId_zip_eq | null |
applyId_mem_iff [DecidableEq α] {xs ys : List α} (h₀ : List.Nodup xs) (h₁ : xs ~ ys)
(x : α) : List.applyId.{u} (xs.zip ys) x ∈ ys ↔ x ∈ xs := by
simp only [List.applyId]
cases h₃ : List.dlookup x (List.map Prod.toSigma (xs.zip ys)) with
| none =>
dsimp [Option.getD]
rw [h₁.mem_iff]
| some val =>
have h₂ : ys.Nodup := h₁.nodup_iff.1 h₀
replace h₁ : xs.length = ys.length := h₁.length_eq
dsimp
induction xs generalizing ys with
| nil => contradiction
| cons x' xs xs_ih =>
rcases ys with - | ⟨y, ys⟩
· cases h₃
dsimp [List.dlookup] at h₃; split_ifs at h₃ with h
· rw [Option.some_inj] at h₃
subst x'; subst val
simp only [List.mem_cons, true_or]
· obtain - | ⟨h₀, h₅⟩ := h₀
obtain - | ⟨h₂, h₄⟩ := h₂
have h₆ := Nat.succ.inj h₁
specialize xs_ih h₅ h₃ h₄ h₆
simp only [Ne.symm h, xs_ih, List.mem_cons]
suffices val ∈ ys by tauto
rw [← Option.mem_def, List.mem_dlookup_iff] at h₃
· simp only [Prod.toSigma, List.mem_map, Prod.exists] at h₃
rcases h₃ with ⟨a, b, h₃, h₄, h₅⟩
apply (List.of_mem_zip h₃).2
simp only [List.NodupKeys, List.keys, comp_def, Prod.fst_toSigma, List.map_map]
rwa [List.map_fst_zip (le_of_eq h₆)] | theorem | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | applyId_mem_iff | null |
List.applyId_eq_self [DecidableEq α] {xs ys : List α} (x : α) :
x ∉ xs → List.applyId.{u} (xs.zip ys) x = x := by
intro h
dsimp [List.applyId]
rw [List.dlookup_eq_none.2]
· rfl
simp only [List.keys, not_exists, Prod.toSigma, exists_and_right, exists_eq_right, List.mem_map,
Function.comp_apply, List.map_map, Prod.exists]
intro y hy
exact h (List.of_mem_zip hy).1 | theorem | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | List.applyId_eq_self | null |
applyId_injective [DecidableEq α] {xs ys : List α} (h₀ : List.Nodup xs) (h₁ : xs ~ ys) :
Injective.{u + 1, u + 1} (List.applyId (xs.zip ys)) := by
intro x y h
by_cases hx : x ∈ xs <;> by_cases hy : y ∈ xs
· rw [List.mem_iff_getElem?] at hx hy
obtain ⟨i, hx⟩ := hx
obtain ⟨j, hy⟩ := hy
suffices some x = some y by injection this
have h₂ := h₁.length_eq
rw [List.applyId_zip_eq h₀ h₂ _ _ _ hx] at h
rw [← hx, ← hy]; congr
apply List.getElem?_inj _ (h₁.nodup_iff.1 h₀)
· symm; rw [h]
rw [← List.applyId_zip_eq] <;> assumption
· rw [← h₁.length_eq]
rw [List.getElem?_eq_some_iff] at hx
obtain ⟨hx, hx'⟩ := hx
exact hx
· rw [← applyId_mem_iff h₀ h₁] at hx hy
rw [h] at hx
contradiction
· rw [← applyId_mem_iff h₀ h₁] at hx hy
rw [h] at hx
contradiction
· rwa [List.applyId_eq_self, List.applyId_eq_self] at h <;> assumption
open TotalFunction (List.toFinmap')
open SampleableExt | theorem | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | applyId_injective | null |
Perm.slice [DecidableEq α] (n m : ℕ) :
(Σ' xs ys : List α, xs ~ ys ∧ ys.Nodup) → Σ' xs ys : List α, xs ~ ys ∧ ys.Nodup
| ⟨xs, ys, h, h'⟩ =>
let xs' := List.dropSlice n m xs
have h₀ : xs' ~ ys.inter xs' := List.Perm.dropSlice_inter _ _ h h'
⟨xs', ys.inter xs', h₀, h'.inter _⟩ | def | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | Perm.slice | Remove a slice of length `m` at index `n` in a list and a permutation, maintaining the property
that it is a permutation. |
sliceSizes : ℕ → MLList Id ℕ+
| n =>
if h : 0 < n then
have : n / 2 < n := Nat.div_lt_self h (by decide : 1 < 2)
.cons ⟨_, h⟩ (sliceSizes <| n / 2)
else .nil | def | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | sliceSizes | A list, in decreasing order, of sizes that should be
sliced off a list of length `n` |
protected shrinkPerm {α : Type} [DecidableEq α] :
(Σ' xs ys : List α, xs ~ ys ∧ ys.Nodup) → List (Σ' xs ys : List α, xs ~ ys ∧ ys.Nodup)
| xs => do
let k := xs.1.length
let n ← (sliceSizes k).force
let i ← List.finRange <| k / n
pure <| Perm.slice (i * n) n xs | def | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | shrinkPerm | Shrink a permutation of a list, slicing a segment in the middle.
The sizes of the slice being removed start at `n` (with `n` the length
of the list) and then `n / 2`, then `n / 4`, etc. down to 1. The slices
will be taken at index `0`, `n / k`, `2n / k`, `3n / k`, etc. |
protected shrink {α : Type} [DecidableEq α] :
InjectiveFunction α → List (InjectiveFunction α)
| ⟨_, h₀, h₁⟩ => do
let ⟨xs', ys', h₀, h₁⟩ ← InjectiveFunction.shrinkPerm ⟨_, _, h₀, h₁⟩
have h₃ : xs'.length ≤ ys'.length := le_of_eq (List.Perm.length_eq h₀)
have h₄ : ys'.length ≤ xs'.length := le_of_eq (List.Perm.length_eq h₀.symm)
pure
⟨(List.zip xs' ys').map Prod.toSigma,
by simp only [comp_def, List.map_fst_zip, List.map_snd_zip, *, Prod.fst_toSigma,
Prod.snd_toSigma, List.map_map],
by simp only [comp_def, List.map_snd_zip, *, Prod.snd_toSigma, List.map_map]⟩ | def | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | shrink | Shrink an injective function slicing a segment in the middle of the domain and removing
the corresponding elements in the codomain, hence maintaining the property that
one is a permutation of the other. |
protected mk (xs ys : List α) (h : xs ~ ys) (h' : ys.Nodup) : InjectiveFunction α :=
have h₀ : xs.length ≤ ys.length := le_of_eq h.length_eq
have h₁ : ys.length ≤ xs.length := le_of_eq h.length_eq.symm
InjectiveFunction.mapToSelf (List.toFinmap' (xs.zip ys))
(by
simp only [List.toFinmap', comp_def, List.map_fst_zip, List.map_snd_zip, *,
List.map_map])
(by simp only [List.toFinmap', comp_def, List.map_snd_zip, *, List.map_map]) | def | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | mk | Create an injective function from one list and a permutation of that list. |
protected injective [DecidableEq α] (f : InjectiveFunction α) : Injective (apply f) := by
obtain ⟨xs, hperm, hnodup⟩ := f
generalize h₀ : List.map Sigma.fst xs = xs₀
generalize h₁ : xs.map (@id ((Σ _ : α, α) → α) <| @Sigma.snd α fun _ : α => α) = xs₁
dsimp [id] at h₁
have hxs : xs = TotalFunction.List.toFinmap' (xs₀.zip xs₁) := by
rw [← h₀, ← h₁, List.toFinmap']; clear h₀ h₁ xs₀ xs₁ hperm hnodup
induction xs with
| nil => simp only [List.zip_nil_right, List.map_nil]
| cons xs_hd xs_tl xs_ih =>
simp only [Sigma.eta, List.zip_cons_cons,
List.map, List.cons_inj_right]
exact xs_ih
revert hperm hnodup
rw [hxs]; intro hperm hnodup
apply InjectiveFunction.applyId_injective
· rwa [← h₀, hxs, hperm.nodup_iff]
· rwa [← hxs, h₀, h₁] at hperm | theorem | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | injective | null |
PiInjective.sampleableExt : SampleableExt { f : ℤ → ℤ // Function.Injective f } where
proxy := InjectiveFunction ℤ
interp f := ⟨apply f, f.injective⟩
shrink := {shrink := @InjectiveFunction.shrink ℤ _ } | instance | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | PiInjective.sampleableExt | null |
Injective.testable (f : α → β)
[I : Testable (NamedBinder "x" <|
∀ x : α, NamedBinder "y" <| ∀ y : α, NamedBinder "H" <| f x = f y → x = y)] :
Testable (Injective f) :=
I | instance | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | Injective.testable | null |
Monotone.testable [Preorder α] [Preorder β] (f : α → β)
[I : Testable (NamedBinder "x" <|
∀ x : α, NamedBinder "y" <| ∀ y : α, NamedBinder "H" <| x ≤ y → f x ≤ f y)] :
Testable (Monotone f) :=
I | instance | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | Monotone.testable | null |
Antitone.testable [Preorder α] [Preorder β] (f : α → β)
[I : Testable (NamedBinder "x" <|
∀ x : α, NamedBinder "y" <| ∀ y : α, NamedBinder "H" <| x ≤ y → f y ≤ f x)] :
Testable (Antitone f) :=
I | instance | Testing | [
"Mathlib.Data.Finsupp.ToDFinsupp",
"Mathlib.Algebra.Order.Group.Nat",
"Mathlib.Data.Int.Range",
"Mathlib.Data.List.Sigma",
"Plausible.Functions"
] | Mathlib/Testing/Plausible/Functions.lean | Antitone.testable | null |
Rat.shrinkable : Shrinkable Rat where
shrink r :=
(Shrinkable.shrink r.num).flatMap fun d => Nat.shrink r.den |>.map fun n => Rat.divInt d n | instance | Testing | [
"Mathlib.Data.Int.Order.Basic",
"Mathlib.Data.List.Monad",
"Mathlib.Data.PNat.Defs",
"Plausible.Sampleable"
] | Mathlib/Testing/Plausible/Sampleable.lean | Rat.shrinkable | null |
PNat.shrinkable : Shrinkable PNat where
shrink m := Nat.shrink m.natPred |>.map Nat.succPNat | instance | Testing | [
"Mathlib.Data.Int.Order.Basic",
"Mathlib.Data.List.Monad",
"Mathlib.Data.PNat.Defs",
"Plausible.Sampleable"
] | Mathlib/Testing/Plausible/Sampleable.lean | PNat.shrinkable | null |
Rat.sampleableExt : SampleableExt Rat :=
mkSelfContained (do
let d ← choose Int (-(← getSize)) (← getSize)
(le_trans (Int.neg_nonpos_of_nonneg (Int.ofNat_zero_le _)) (Int.ofNat_zero_le _))
let n ← choose Nat 0 (← getSize) (Nat.zero_le _)
return Rat.divInt d n) | instance | Testing | [
"Mathlib.Data.Int.Order.Basic",
"Mathlib.Data.List.Monad",
"Mathlib.Data.PNat.Defs",
"Plausible.Sampleable"
] | Mathlib/Testing/Plausible/Sampleable.lean | Rat.sampleableExt | null |
PNat.sampleableExt : SampleableExt PNat :=
mkSelfContained (do
let n ← chooseNat
return Nat.succPNat n) | instance | Testing | [
"Mathlib.Data.Int.Order.Basic",
"Mathlib.Data.List.Monad",
"Mathlib.Data.PNat.Defs",
"Plausible.Sampleable"
] | Mathlib/Testing/Plausible/Sampleable.lean | PNat.sampleableExt | null |
factTestable {p : Prop} [Testable p] : Testable (Fact p) where
run cfg min := do
let h ← runProp p cfg min
pure <| iff fact_iff h | instance | Testing | [
"Plausible.Testable",
"Mathlib.Logic.Basic"
] | Mathlib/Testing/Plausible/Testable.lean | factTestable | null |
Fact.printableProp {p : Prop} [PrintableProp p] : PrintableProp (Fact p) where
printProp := printProp p | instance | Testing | [
"Plausible.Testable",
"Mathlib.Logic.Basic"
] | Mathlib/Testing/Plausible/Testable.lean | Fact.printableProp | null |
continuous_linear_iff {f : P →ᵃ[R] Q} : Continuous f.linear ↔ Continuous f := by
inhabit P
have :
(f.linear : V → W) =
(Homeomorph.vaddConst <| f default).symm ∘ f ∘ (Homeomorph.vaddConst default) := by
ext v
simp
rw [this]
simp only [Homeomorph.comp_continuous_iff, Homeomorph.comp_continuous_iff'] | theorem | Topology | [
"Mathlib.LinearAlgebra.AffineSpace.AffineMap",
"Mathlib.LinearAlgebra.AffineSpace.Midpoint",
"Mathlib.Topology.Algebra.Group.AddTorsor"
] | Mathlib/Topology/Algebra/Affine.lean | continuous_linear_iff | If `f` is an affine map, then its linear part is continuous iff `f` is continuous. |
@[deprecated continuous_linear_iff (since := "2025-09-13")]
continuous_iff {f : P →ᵃ[R] Q} : Continuous f ↔ Continuous f.linear :=
continuous_linear_iff.symm | theorem | Topology | [
"Mathlib.LinearAlgebra.AffineSpace.AffineMap",
"Mathlib.LinearAlgebra.AffineSpace.Midpoint",
"Mathlib.Topology.Algebra.Group.AddTorsor"
] | Mathlib/Topology/Algebra/Affine.lean | continuous_iff | An affine map is continuous iff its underlying linear map is continuous. See also
`AffineMap.continuous_linear_iff`. |
isOpenMap_linear_iff {f : P →ᵃ[R] Q} : IsOpenMap f.linear ↔ IsOpenMap f := by
inhabit P
have :
(f.linear : V → W) =
(Homeomorph.vaddConst <| f default).symm ∘ f ∘ (Homeomorph.vaddConst default) := by
ext v
simp
rw [this]
simp only [Homeomorph.comp_isOpenMap_iff, Homeomorph.comp_isOpenMap_iff']
variable [TopologicalSpace R] [ContinuousSMul R V] | theorem | Topology | [
"Mathlib.LinearAlgebra.AffineSpace.AffineMap",
"Mathlib.LinearAlgebra.AffineSpace.Midpoint",
"Mathlib.Topology.Algebra.Group.AddTorsor"
] | Mathlib/Topology/Algebra/Affine.lean | isOpenMap_linear_iff | If `f` is an affine map, then its linear part is an open map iff `f` is an open map. |
@[continuity, fun_prop]
lineMap_continuous {p q : P} :
Continuous (lineMap p q : R →ᵃ[R] P) := by
rw [coe_lineMap]
fun_prop
variable {α : Type*} {l : Filter α}
open Topology Filter | theorem | Topology | [
"Mathlib.LinearAlgebra.AffineSpace.AffineMap",
"Mathlib.LinearAlgebra.AffineSpace.Midpoint",
"Mathlib.Topology.Algebra.Group.AddTorsor"
] | Mathlib/Topology/Algebra/Affine.lean | lineMap_continuous | The line map is continuous. |
_root_.Filter.Tendsto.lineMap {f₁ f₂ : α → P} {g : α → R} {p₁ p₂ : P} {c : R}
(h₁ : Tendsto f₁ l (𝓝 p₁)) (h₂ : Tendsto f₂ l (𝓝 p₂)) (hg : Tendsto g l (𝓝 c)) :
Tendsto (fun x => AffineMap.lineMap (f₁ x) (f₂ x) (g x)) l (𝓝 <| AffineMap.lineMap p₁ p₂ c) :=
(hg.smul (h₂.vsub h₁)).vadd h₁ | theorem | Topology | [
"Mathlib.LinearAlgebra.AffineSpace.AffineMap",
"Mathlib.LinearAlgebra.AffineSpace.Midpoint",
"Mathlib.Topology.Algebra.Group.AddTorsor"
] | Mathlib/Topology/Algebra/Affine.lean | _root_.Filter.Tendsto.lineMap | null |
_root_.Filter.Tendsto.midpoint [Invertible (2 : R)] {f₁ f₂ : α → P} {p₁ p₂ : P}
(h₁ : Tendsto f₁ l (𝓝 p₁)) (h₂ : Tendsto f₂ l (𝓝 p₂)) :
Tendsto (fun x => midpoint R (f₁ x) (f₂ x)) l (𝓝 <| midpoint R p₁ p₂) :=
h₁.lineMap h₂ tendsto_const_nhds | theorem | Topology | [
"Mathlib.LinearAlgebra.AffineSpace.AffineMap",
"Mathlib.LinearAlgebra.AffineSpace.Midpoint",
"Mathlib.Topology.Algebra.Group.AddTorsor"
] | Mathlib/Topology/Algebra/Affine.lean | _root_.Filter.Tendsto.midpoint | null |
@[continuity, fun_prop]
homothety_continuous (x : P) (t : R) : Continuous <| homothety x t := by
rw [coe_homothety]
fun_prop
variable (R) [TopologicalSpace R] [Module R W] [ContinuousSMul R W] (x : Q) {s : Set Q}
open Topology | theorem | Topology | [
"Mathlib.LinearAlgebra.AffineSpace.AffineMap",
"Mathlib.LinearAlgebra.AffineSpace.Midpoint",
"Mathlib.Topology.Algebra.Group.AddTorsor"
] | Mathlib/Topology/Algebra/Affine.lean | homothety_continuous | null |
_root_.eventually_homothety_mem_of_mem_interior {y : Q} (hy : y ∈ interior s) :
∀ᶠ δ in 𝓝 (1 : R), homothety x δ y ∈ s := by
have cont : Continuous (fun δ : R => homothety x δ y) := lineMap_continuous
filter_upwards [cont.tendsto' 1 y (by simp) |>.eventually (isOpen_interior.eventually_mem hy)]
with _ h using interior_subset h | theorem | Topology | [
"Mathlib.LinearAlgebra.AffineSpace.AffineMap",
"Mathlib.LinearAlgebra.AffineSpace.Midpoint",
"Mathlib.Topology.Algebra.Group.AddTorsor"
] | Mathlib/Topology/Algebra/Affine.lean | _root_.eventually_homothety_mem_of_mem_interior | null |
_root_.eventually_homothety_image_subset_of_finite_subset_interior {t : Set Q}
(ht : t.Finite) (h : t ⊆ interior s) : ∀ᶠ δ in 𝓝 (1 : R), homothety x δ '' t ⊆ s := by
suffices ∀ y ∈ t, ∀ᶠ δ in 𝓝 (1 : R), homothety x δ y ∈ s by
simp_rw [Set.image_subset_iff]
exact (Filter.eventually_all_finite ht).mpr this
intro y hy
exact eventually_homothety_mem_of_mem_interior R x (h hy) | theorem | Topology | [
"Mathlib.LinearAlgebra.AffineSpace.AffineMap",
"Mathlib.LinearAlgebra.AffineSpace.Midpoint",
"Mathlib.Topology.Algebra.Group.AddTorsor"
] | Mathlib/Topology/Algebra/Affine.lean | _root_.eventually_homothety_image_subset_of_finite_subset_interior | null |
homothety_isOpenMap (x : P) (t : R) (ht : t ≠ 0) : IsOpenMap <| homothety x t := by
apply IsOpenMap.of_inverse (homothety_continuous x t⁻¹) <;> intro e <;>
simp [← AffineMap.comp_apply, ← homothety_mul, ht] | theorem | Topology | [
"Mathlib.LinearAlgebra.AffineSpace.AffineMap",
"Mathlib.LinearAlgebra.AffineSpace.Midpoint",
"Mathlib.Topology.Algebra.Group.AddTorsor"
] | Mathlib/Topology/Algebra/Affine.lean | homothety_isOpenMap | null |
subtypeA (s : AffineSubspace R P) [Nonempty s] : s →ᴬ[R] P where
toAffineMap := s.subtype
cont := continuous_subtype_val
@[simp] lemma coe_subtypeA (s : AffineSubspace R P) [Nonempty s] : ⇑s.subtypeA = Subtype.val :=
rfl
@[simp] lemma subtypeA_toAffineMap (s : AffineSubspace R P) [Nonempty s] :
s.subtypeA.toAffineMap = s.subtype :=
rfl
variable [TopologicalSpace V] [IsTopologicalAddTorsor P] | def | Topology | [
"Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic",
"Mathlib.Topology.Algebra.ContinuousAffineMap",
"Mathlib.Topology.Algebra.Group.AddTorsor"
] | Mathlib/Topology/Algebra/AffineSubspace.lean | subtypeA | Embedding of an affine subspace to the ambient space, as a continuous affine map. |
isClosed_direction_iff [T1Space V] (s : AffineSubspace R P) :
IsClosed (s.direction : Set V) ↔ IsClosed (s : Set P) := by
rcases s.eq_bot_or_nonempty with (rfl | ⟨x, hx⟩); · simp
rw [← (Homeomorph.vaddConst x).symm.isClosed_image,
AffineSubspace.coe_direction_eq_vsub_set_right hx]
simp only [Homeomorph.vaddConst_symm_apply] | theorem | Topology | [
"Mathlib.LinearAlgebra.AffineSpace.AffineSubspace.Basic",
"Mathlib.Topology.Algebra.ContinuousAffineMap",
"Mathlib.Topology.Algebra.Group.AddTorsor"
] | Mathlib/Topology/Algebra/AffineSubspace.lean | isClosed_direction_iff | null |
@[continuity, fun_prop]
continuous_algebraMap [ContinuousSMul R A] : Continuous (algebraMap R A) := by
rw [algebraMap_eq_smul_one']
exact continuous_id.smul continuous_const | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | continuous_algebraMap | null |
continuous_algebraMap_iff_smul [ContinuousMul A] :
Continuous (algebraMap R A) ↔ Continuous fun p : R × A => p.1 • p.2 := by
refine ⟨fun h => ?_, fun h => have : ContinuousSMul R A := ⟨h⟩; continuous_algebraMap _ _⟩
simp only [Algebra.smul_def]
exact (h.comp continuous_fst).mul continuous_snd | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | continuous_algebraMap_iff_smul | null |
continuousSMul_of_algebraMap [ContinuousMul A] (h : Continuous (algebraMap R A)) :
ContinuousSMul R A :=
⟨(continuous_algebraMap_iff_smul R A).1 h⟩ | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | continuousSMul_of_algebraMap | null |
Subalgebra.continuousSMul (S : Subalgebra R A) (X) [TopologicalSpace X] [MulAction A X]
[ContinuousSMul A X] : ContinuousSMul S X :=
Subsemiring.continuousSMul S.toSubsemiring X | instance | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | Subalgebra.continuousSMul | null |
@[simps]
algebraMapCLM : R →L[R] A :=
{ Algebra.linearMap R A with
toFun := algebraMap R A
cont := continuous_algebraMap R A } | def | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | algebraMapCLM | The inclusion of the base ring in a topological algebra as a continuous linear map. |
algebraMapCLM_coe : ⇑(algebraMapCLM R A) = algebraMap R A :=
rfl | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | algebraMapCLM_coe | null |
algebraMapCLM_toLinearMap : (algebraMapCLM R A).toLinearMap = Algebra.linearMap R A :=
rfl | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | algebraMapCLM_toLinearMap | null |
DiscreteTopology.instContinuousSMul [IsTopologicalSemiring A] [DiscreteTopology R] :
ContinuousSMul R A := continuousSMul_of_algebraMap _ _ continuous_of_discreteTopology | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | DiscreteTopology.instContinuousSMul | If `R` is a discrete topological ring, then any topological ring `S` which is an `R`-algebra
is also a topological `R`-algebra.
NB: This could be an instance but the signature makes it very expensive in search.
See https://github.com/leanprover-community/mathlib4/pull/15339
for the regressions caused by making this an instance. |
ContinuousAlgHom (R : Type*) [CommSemiring R] (A : Type*) [Semiring A]
[TopologicalSpace A] (B : Type*) [Semiring B] [TopologicalSpace B] [Algebra R A] [Algebra R B]
extends A →ₐ[R] B where
cont : Continuous toFun := by fun_prop
@[inherit_doc]
notation:25 A " →A[" R "] " B => ContinuousAlgHom R A B | structure | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | ContinuousAlgHom | Continuous algebra homomorphisms between algebras. We only put the type classes that are
necessary for the definition, although in applications `M` and `B` will be topological algebras
over the topological ring `R`. |
@[simp]
toAlgHom_eq_coe (f : A →A[R] B) : f.toAlgHom = f := rfl
@[simp, norm_cast] | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | toAlgHom_eq_coe | null |
coe_inj {f g : A →A[R] B} : (f : A →ₐ[R] B) = g ↔ f = g := by
cases f; cases g; simp only [mk.injEq]; exact Eq.congr_right rfl
@[simp] | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | coe_inj | null |
coe_mk (f : A →ₐ[R] B) (h) : (mk f h : A →ₐ[R] B) = f := rfl
@[simp] | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | coe_mk | null |
coe_mk' (f : A →ₐ[R] B) (h) : (mk f h : A → B) = f := rfl
@[simp, norm_cast] | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | coe_mk' | null |
coe_coe (f : A →A[R] B) : ⇑(f : A →ₐ[R] B) = f := rfl | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | coe_coe | null |
@[fun_prop]
protected continuous (f : A →A[R] B) : Continuous f := f.2 | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | continuous | null |
protected uniformContinuous {E₁ E₂ : Type*} [UniformSpace E₁] [UniformSpace E₂]
[Ring E₁] [Ring E₂] [Algebra R E₁] [Algebra R E₂] [IsUniformAddGroup E₁]
[IsUniformAddGroup E₂] (f : E₁ →A[R] E₂) : UniformContinuous f :=
uniformContinuous_addMonoidHom_of_continuous f.continuous | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | uniformContinuous | null |
Simps.apply (h : A →A[R] B) : A → B := h | def | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | Simps.apply | See Note [custom simps projection]. We need to specify this projection explicitly in this case,
because it is a composition of multiple projections. |
Simps.coe (h : A →A[R] B) : A →ₐ[R] B := h
initialize_simps_projections ContinuousAlgHom (toFun → apply, toAlgHom → coe)
@[ext] | def | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | Simps.coe | See Note [custom simps projection]. |
ext {f g : A →A[R] B} (h : ∀ x, f x = g x) : f = g := DFunLike.ext f g h | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | ext | null |
copy (f : A →A[R] B) (f' : A → B) (h : f' = ⇑f) : A →A[R] B where
toAlgHom := {
toRingHom := (f : A →A[R] B).toRingHom.copy f' h
commutes' := fun r => by
simp only [AlgHom.toRingHom_eq_coe, h, RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe,
MonoidHom.toOneHom_coe, MonoidHom.coe_coe, RingHom.coe_copy, AlgHomClass.commutes f r] }
cont := show Continuous f' from h.symm ▸ f.continuous
@[simp] | def | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | copy | Copy of a `ContinuousAlgHom` with a new `toFun` equal to the old one. Useful to fix
definitional equalities. |
coe_copy (f : A →A[R] B) (f' : A → B) (h : f' = ⇑f) : ⇑(f.copy f' h) = f' := rfl | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | coe_copy | null |
copy_eq (f : A →A[R] B) (f' : A → B) (h : f' = ⇑f) : f.copy f' h = f := DFunLike.ext' h | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | copy_eq | null |
protected map_zero (f : A →A[R] B) : f (0 : A) = 0 := map_zero f | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | map_zero | null |
protected map_add (f : A →A[R] B) (x y : A) : f (x + y) = f x + f y := map_add f x y | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | map_add | null |
protected map_smul (f : A →A[R] B) (c : R) (x : A) :
f (c • x) = c • f x :=
map_smul .. | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | map_smul | null |
map_smul_of_tower {R S : Type*} [CommSemiring S] [SMul R A] [Algebra S A] [SMul R B]
[Algebra S B] [MulActionHomClass (A →A[S] B) R A B] (f : A →A[S] B) (c : R) (x : A) :
f (c • x) = c • f x :=
map_smul f c x | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | map_smul_of_tower | null |
protected map_sum {ι : Type*} (f : A →A[R] B) (s : Finset ι) (g : ι → A) :
f (∑ i ∈ s, g i) = ∑ i ∈ s, f (g i) :=
map_sum .. | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | map_sum | null |
@[ext (iff := false)]
ext_ring [TopologicalSpace R] {f g : R →A[R] A} : f = g :=
coe_inj.mp (ext_id _ _ _) | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | ext_ring | Any two continuous `R`-algebra morphisms from `R` are equal |
ext_ring_iff [TopologicalSpace R] {f g : R →A[R] A} : f = g ↔ f 1 = g 1 :=
⟨fun h => h ▸ rfl, fun _ => ext_ring ⟩ | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | ext_ring_iff | null |
eqOn_closure_adjoin [T2Space B] {s : Set A} {f g : A →A[R] B} (h : Set.EqOn f g s) :
Set.EqOn f g (closure (Algebra.adjoin R s : Set A)) :=
Set.EqOn.closure (AlgHom.eqOn_adjoin_iff.mpr h) f.continuous g.continuous | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | eqOn_closure_adjoin | If two continuous algebra maps are equal on a set `s`, then they are equal on the closure
of the `Algebra.adjoin` of this set. |
ext_on [T2Space B] {s : Set A} (hs : Dense (Algebra.adjoin R s : Set A))
{f g : A →A[R] B} (h : Set.EqOn f g s) : f = g :=
ext fun x => eqOn_closure_adjoin h (hs x)
variable [IsTopologicalSemiring A] | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | ext_on | If the subalgebra generated by a set `s` is dense in the ambient module, then two continuous
algebra maps equal on `s` are equal. |
_root_.Subalgebra.topologicalClosure (s : Subalgebra R A) : Subalgebra R A where
toSubsemiring := s.toSubsemiring.topologicalClosure
algebraMap_mem' r := by
simp only [Subsemiring.coe_carrier_toSubmonoid, Subsemiring.topologicalClosure_coe,
Subalgebra.coe_toSubsemiring]
apply subset_closure
exact algebraMap_mem s r | def | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | _root_.Subalgebra.topologicalClosure | The topological closure of a subalgebra |
_root_.Subalgebra.map_topologicalClosure_le
[IsTopologicalSemiring B] (f : A →A[R] B) (s : Subalgebra R A) :
map f s.topologicalClosure ≤ (map f.toAlgHom s).topologicalClosure :=
image_closure_subset_closure_image f.continuous | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | _root_.Subalgebra.map_topologicalClosure_le | Under a continuous algebra map, the image of the `TopologicalClosure` of a subalgebra is
contained in the `TopologicalClosure` of its image. |
_root_.Subalgebra.topologicalClosure_map_le [IsTopologicalSemiring B]
(f : A →ₐ[R] B) (hf : IsClosedMap f) (s : Subalgebra R A) :
(map f s).topologicalClosure ≤ map f s.topologicalClosure :=
hf.closure_image_subset _ | lemma | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | _root_.Subalgebra.topologicalClosure_map_le | null |
_root_.Subalgebra.topologicalClosure_map [IsTopologicalSemiring B]
(f : A →A[R] B) (hf : IsClosedMap f) (s : Subalgebra R A) :
(map f.toAlgHom s).topologicalClosure = map f.toAlgHom s.topologicalClosure :=
SetLike.coe_injective <| hf.closure_image_eq_of_continuous f.continuous _
@[simp] | lemma | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | _root_.Subalgebra.topologicalClosure_map | null |
_root_.Subalgebra.topologicalClosure_coe (s : Subalgebra R A) :
(s.topologicalClosure : Set A) = closure ↑s := rfl | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | _root_.Subalgebra.topologicalClosure_coe | null |
_root_.DenseRange.topologicalClosure_map_subalgebra
[IsTopologicalSemiring B] {f : A →A[R] B} (hf' : DenseRange f) {s : Subalgebra R A}
(hs : s.topologicalClosure = ⊤) : (s.map (f : A →ₐ[R] B)).topologicalClosure = ⊤ := by
rw [SetLike.ext'_iff] at hs ⊢
simp only [Subalgebra.topologicalClosure_coe, coe_top, ← dense_iff_closure_eq, Subalgebra.coe_map,
AlgHom.coe_coe] at hs ⊢
exact hf'.dense_image f.continuous hs | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | _root_.DenseRange.topologicalClosure_map_subalgebra | Under a dense continuous algebra map, a subalgebra
whose `TopologicalClosure` is `⊤` is sent to another such submodule.
That is, the image of a dense subalgebra under a map with dense range is dense. |
protected id : A →A[R] A := ⟨AlgHom.id R A, continuous_id⟩ | def | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | id | The identity map as a continuous algebra homomorphism. |
one_def : (1 : A →A[R] A) = ContinuousAlgHom.id R A := rfl | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | one_def | null |
id_apply (x : A) : ContinuousAlgHom.id R A x = x := rfl
@[simp, norm_cast] | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | id_apply | null |
coe_id : ((ContinuousAlgHom.id R A) : A →ₐ[R] A) = AlgHom.id R A:= rfl
@[simp, norm_cast] | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | coe_id | null |
coe_id' : ⇑(ContinuousAlgHom.id R A ) = _root_.id := rfl
@[simp, norm_cast] | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | coe_id' | null |
coe_eq_id {f : A →A[R] A} :
(f : A →ₐ[R] A) = AlgHom.id R A ↔ f = ContinuousAlgHom.id R A:= by
rw [← coe_id, coe_inj]
@[simp] | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | coe_eq_id | null |
one_apply (x : A) : (1 : A →A[R] A) x = x := rfl | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | one_apply | null |
comp (g : B →A[R] C) (f : A →A[R] B) : A →A[R] C :=
⟨(g : B →ₐ[R] C).comp (f : A →ₐ[R] B), g.2.comp f.2⟩
@[simp, norm_cast] | def | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | comp | Composition of continuous algebra homomorphisms. |
coe_comp (h : B →A[R] C) (f : A →A[R] B) :
(h.comp f : A →ₐ[R] C) = (h : B →ₐ[R] C).comp (f : A →ₐ[R] B) := rfl
@[simp, norm_cast] | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | coe_comp | null |
coe_comp' (h : B →A[R] C) (f : A →A[R] B) : ⇑(h.comp f) = h ∘ f := rfl | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | coe_comp' | null |
comp_apply (g : B →A[R] C) (f : A →A[R] B) (x : A) : (g.comp f) x = g (f x) := rfl
@[simp] | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | comp_apply | null |
comp_id (f : A →A[R] B) : f.comp (ContinuousAlgHom.id R A) = f :=
ext fun _x => rfl
@[simp] | theorem | Topology | [
"Mathlib.Algebra.Algebra.Subalgebra.Lattice",
"Mathlib.Algebra.Algebra.Tower",
"Mathlib.Topology.Algebra.Module.LinearMap"
] | Mathlib/Topology/Algebra/Algebra.lean | comp_id | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.