我想证明"A函数是内射的,那么它有左逆。“在精益公司。
正如你所知道的,在这个定理的标准证明( https://math.stackexchange.com/questions/2099699/left-inverse-in-f-a-iff-injective-proof )中,我们应该定义一个由逐个案例形式定义的函数。但我认为在精益验证器中无法定义逐个案例的形式函数。
我怎样才能在精益公司证明这一点呢?
发布于 2022-06-28 08:40:28
使用if...then...else
逐个案例定义。
import tactic
open function
open_locale classical
-- Theorem: if A is nonempty then an injective function from it
-- has a one-sided inverse
example (A B : Type) [inhabited A] (f : A → B) (hf : injective f) :
∃ g : B → A, g ∘ f = id :=
-- Proof:
begin
-- define the function in the obvious way; it's the inverse on the image
-- and a random element of A otherwise (works because A is inhabited)
let g : B → A := λ b, if h : ∃ a, f a = b then h.some else arbitrary A,
-- claim g works
use g,
-- let's take an arbitrary element a of A
ext a,
-- and let's note that there exists an element of a whose image
-- under f is f(a), namely a itself!
have ha : ∃ a' : A, f a' = f a := ⟨a, rfl⟩,
-- Now unravel the definition of g and follow your nose.
simp [g],
-- We now need to prove that the "random" element g chose
-- must be the a we started with, but how do we rule out lots of
-- different a's mapping to the same b? We use injectivity of f.
apply hf,
-- and now we're done
exact ha.some_spec,
end
发布于 2022-06-28 12:14:03
这是在mathlib中function.inv_fun
和function.left_inverse_inv_fun
下面的几行代码。
https://stackoverflow.com/questions/72783021
复制相似问题