annotate exercise/001.ind @ 332:6f3636fbc481

fix
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 12 Mar 2023 22:49:59 +0900
parents a7f09c9a2c7a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 -title: 関数適用による証明
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 A → B → A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 を証明してみよう。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
6
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 まず、証明する式の上に線分を引く。これは「推論して、 A → B → A を導く」ということである。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 ----------------
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 A → B → A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
11
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
12 まず、かっこを正しく付ける。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
13
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 --------------------
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 A → ( B → A )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
16
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 であることを思い出そう。ここで使える推論規則は、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20 :
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 B
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22 ------------ →-intro
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
23 A → B
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
24
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
25 である。これのBの部分が ( B → A ) になっている。これにより、Aを仮定として使って良くなる。つまり、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 は無条件に使って良い。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
30
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
31 A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
32 :
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
33 B → A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 --------------------
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
35 A → ( B → A )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 : の部分は自分で埋める必要がある。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 B → A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 の部分に集中しよう。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 --------------------
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44 B → A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
45
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 となる。同じ推論規則から、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 B
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
49 :
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 --------------------
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52 B → A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
53
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
54 となる。A は無条件に使って良かった。まとめると、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56 A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
57 --------------------
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
58 B → A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
59 --------------------
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
60 A → ( B → A )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
61
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
62 これで証明がつながった。→-intro は二回使ったので番号を付けて区別する。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 →-intro が生成した仮定には同じ番号を付けて[]を付加する。これは、
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64 discharge と呼ばれる。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
66 [A]1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 -------------------- →-intro 2
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
68 B → A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 -------------------- →-intro 1
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 A → ( B → A )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
71
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
72 [B]は使ってないが、使わなくて良い。これで証明が完成した。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
73
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
74 B
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
75 :
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
76 A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
77 -------------------- →-intro
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
78 B → A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
79
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
80 は、a : A があった時に、λ (x : B) → a が B → A という型を持つことに相当する。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
81
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
82 b : B
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
83 :
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
84 a : A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
85 -------------------------------
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
86 λ (x : B) → a : B → A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
87
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
88 : の左側は値であり、右側が型になる。
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
89
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
90 証明すべき式は、型
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
91 f : B → A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
92
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
93
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
94
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
95
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
96
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
97
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
98
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
99
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
100
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
101
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
102 <a href="../s02/lambda.agda"> lambda.agda </a>
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
103
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
104
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
105
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
106 module lambda ( T : Set) ( t : T ) where
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
107
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
108
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
109 A→A : (A : Set ) → ( A → A )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
110 A→A = λ A → λ ( a : A ) → a
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
111
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
112 lemma2 : (A : Set ) → A → A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
113 lemma2 A a = {!!}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
114
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
115
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
116 ex1 : {A B : Set} → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
117 ex1 {A} {B} = ( A → B ) → A → B
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
118
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
119 ex2 : {A : Set} → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
120 ex2 {A} = A → ( A → A )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
121
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
122 ex3 : {A B : Set} → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
123 ex3 {A}{B} = A → B
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
124
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
125 ex4 : {A B : Set} → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
126 ex4 {A}{B} = A → B → B
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
127
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
128 ex5 : {A B : Set} → Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
129 ex5 {A}{B} = A → B → A
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
130
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
131 proof5 : {A B : Set } → ex5 {A} {B}
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
132 proof5 a b = a
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
133
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
134 postulate S : Set
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
135 postulate s : S
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
136
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
137 ex6 : {A : Set} → A → S
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
138 ex6 a = s
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
139
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
140 ex7 : {A : Set} → A → T
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
141 ex7 a = t
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents:
diff changeset
142