首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在精益验证程序中定义函数?(在"A函数是内射的,则有左逆“中)

如何在精益验证程序中定义函数?(在"A函数是内射的,则有左逆“中)
EN

Stack Overflow用户
提问于 2022-06-28 08:19:30
回答 2查看 136关注 0票数 0

我想证明"A函数是内射的,那么它有左逆。“在精益公司。

正如你所知道的,在这个定理的标准证明( https://math.stackexchange.com/questions/2099699/left-inverse-in-f-a-iff-injective-proof )中,我们应该定义一个由逐个案例形式定义的函数。但我认为在精益验证器中无法定义逐个案例的形式函数。

我怎样才能在精益公司证明这一点呢?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-06-28 08:40:28

使用if...then...else逐个案例定义。

代码语言:javascript
运行
复制
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
票数 2
EN

Stack Overflow用户

发布于 2022-06-28 12:14:03

这是在mathlib中function.inv_funfunction.left_inverse_inv_fun下面的几行代码。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72783021

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档