lean-ja / lean-ja/lean-by-example

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

Open
#1,155 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

コード例
Dominant language
Lean
Stars
188
Forks
15
Avg merge
9h 8m
Merged PRs (30d)
6

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the Lean example in the issue and locating the repository section where related code examples are maintained. Check how existing examples are organized and documented. Done means the product universal-property example is included in the appropriate material and remains valid Lean code.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.