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

choose を使わない例を示す #6

Merged
merged 2 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Examples/Choose.lean
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,24 @@ example (f : X → Y) (hf : ∀ y, ∃ x, f x = y) : ∃ g : Y → X, ∀ y, f (

exact ⟨g, hg⟩
-- ANCHOR_END: first


-- ANCHOR: no_choose
variable (P : X → Y → Prop)

noncomputable example (h : ∀ x, ∃ y, P x y) : ∃ f : X → Y, ∀ x, P x (f x) := by
-- `f` を作る
let f' : (x : X) → {y // P x y} := fun x ↦
have hne_st : Nonempty {y // P x y} :=
let ⟨y, py⟩ := h x; ⟨⟨y, py⟩⟩
Classical.choice hne_st

let f : X → Y := fun x ↦ (f' x).val

-- 上記で作った関数が条件を満たすことを示す
have h₁ : ∀ x, P x (f x) := by
intro x
exact (f' x).property

exists f
-- ANCHOR_END: no_choose
8 changes: 8 additions & 0 deletions src/choose.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,12 @@ needs: `import Mathlib.Tactic.Choose`

```lean
{{#include ../Examples/Choose.lean:first}}
```

## 補足

`choose` が自動で示してくれることは選択原理 `Classical.choice` を使って手動で示すことができます.たとえば次のようになります.

```lean
{{#include ../Examples/Choose.lean:no_choose}}
```