Skip to content

Commit

Permalink
choose 追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Seasawher committed Sep 24, 2023
1 parent 17e76c0 commit dc39ba0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions Examples.lean
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Examples.By
import Examples.ByCases
import Examples.ByContra
import Examples.Cases
import Examples.Choose
import Examples.Constructor
import Examples.Contradiction
import Examples.Convert
Expand Down
16 changes: 16 additions & 0 deletions Examples/Choose.lean
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import Mathlib.Tactic.Choose

variable (X Y : Type)


-- ANCHOR: first
example (f : X → Y) (hf : ∀ y, ∃ x, f x = y) : ∃ g : Y → X, ∀ y, f (g y) = y := by
-- 写像 `g : Y → X` を構成する
choose g hg using hf

-- `g` が満たす条件がローカルコンテキストに追加される
guard_hyp g: Y → X
guard_hyp hg: ∀ (y : Y), f (g y) = y

exact ⟨g, hg⟩
-- ANCHOR_END: first
1 change: 1 addition & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- [by: タクティクモードに入る](./by.md)
- [calc: 計算モードに入る](./calc.md)
- [cases: 論理和∨を使う](./cases.md)
- [choose: ∀x∃yP(x,y)から写像を作る](./choose.md)
- [constructor: 論理積∧を示す](./constructor.md)
- [contradiction: 矛盾](./contradiction.md)
- [conv: 変換モードに入る](./conv.md)
Expand Down
9 changes: 9 additions & 0 deletions src/choose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# choose

needs: `import Mathlib.Tactic.Choose`

`h : ∀ x, ∃ y, P(x, y)` が成り立っているときに,`choose f hf using h` は写像 `f: X → Y``f` が満たす性質 `hf : ∀ x, P(x, f x)` のペアを作ります.

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

0 comments on commit dc39ba0

Please sign in to comment.