Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prod の普遍性を表す簡単な例 #1155

Open
Seasawher opened this issue Nov 23, 2024 · 2 comments
Open

Prod の普遍性を表す簡単な例 #1155

Seasawher opened this issue Nov 23, 2024 · 2 comments

Comments

@Seasawher
Copy link
Member

Seasawher commented Nov 23, 2024

variable {A B C : Type}

/-- 積の普遍性から導かれる射 -/
def fork (f : A → B) (g : A → C) : A → B × C :=
  fun a => (f a, g a)

/-- 第一成分への射影 -/
abbrev exl := @Prod.fst A B

/-- 第二成分への射影 -/
abbrev exr := @Prod.snd A B

open Prod

/-- ### 積の普遍性
すべての積への関数は、`fork` で書き表すことができる。 -/
example (h : A → B × C) : fork (fst ∘ h) (snd ∘ h) = h := rfl

/-- A × B → A × B は fork -/
example : fork fst snd = @id (A × B) := rfl
@Seasawher
Copy link
Member Author

引用元:Calculating Functional Programs の 1.3.4

@Seasawher
Copy link
Member Author

積の普遍性は次のように述べたほうが良い。

import Mathlib.Tactic

/-- ### 積の普遍性
すべての積への関数は、`fork` で書き表すことができる。 -/
example (h : A → B × C) : h = fork f g ↔ fst ∘ h = f ∧ snd ∘ h = g := by
  constructor <;> aesop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant