-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLibTactics_J.v
More file actions
4931 lines (4151 loc) · 202 KB
/
LibTactics_J.v
File metadata and controls
4931 lines (4151 loc) · 202 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
(** * LibTactics_J: 使いやすい汎用タクティックのコレクション *)
(* * LibTactics: A Collection of Handy General-Purpose Tactics *)
(* $Date: 2010-10-14 12:27:18 -0400 (Thu, 14 Oct 2010) $ *)
(* Chapter maintained by Arthur Chargueraud *)
(* This file contains a set of tactics that extends the set of builtin
tactics provided with the standard distribution of Coq. It intends
to overcome a number of limitations of the standard set of tactics,
and thereby to help user to write shorter and more robust scripts.
Hopefully, Coq tactics will be improved as time goes by, and this
file should ultimately be useless. In the meanwhile, serious Coq
users will probably find it very useful.
The present file contains the implementation and the detailed
documentation of those tactics. The SF reader need not read this
file; instead, he/she is encouraged to read the chapter named
UseTactics.v, which is gentle introduction to the most useful
tactics from the LibTactic library. *)
(** このファイルは、
Coqの標準ディストリビューションで提供されるビルトインタクティックを拡張するタクティックのセットを含んでいます。
タクティックの標準セットのいくつもの限界を克服し、
それによってユーザがより短かくより頑強な証明を書けるようにすることを意図したものです。
おそらく、Coqのタクティックは時が経つにつれて改良されて行き、
このファイルは究極的には不要になるでしょう。
それまでの間は、本格的なCoqユーザはおそらくとても便利だと感じるでしょう。
このファイルはそれらのタクティックの実装と詳細なドキュメンテーションを含んでいます。
SFの読者はこのファイルを読む必要はありません。その代わり、UseTactics_J.v
という名前の章を読むと良いでしょう。
その章はLibTacticライブラリの最も便利なタクティックの紹介となっています。 *)
(* The main features offered are:
- More convenient syntax for naming hypotheses, with tactics for
introduction and inversion that take as input only the name of
hypotheses of type [Prop], rather than the name of all variables.
- Tactics providing true support for manipulating N-ary conjunctions,
disjunctions and existentials, hidding the fact that the underlying
implementation is based on binary predicates.
- Convenient support for automation: tactic followed with the symbol
"~" or "*" will call automation on the generated subgoals.
Symbol "~" stands for [auto] and "*" for [intuition eauto].
These bindings can be customized.
- Forward-chaining tactics are provided to instantiate lemmas
either with variable or hypotheses or a mix of both.
- A more powerful implementation of [apply] is provided (it is based
on [refine] and thus behaves better with respect to conversion).
- An improved inversion tactic which substitutes equalities on variables
generated by the standard inversion mecanism. Moreover, it supports
the elimination of dependently-typed equalities (requires axiom [K],
which is a weak form of Proof Irrelevance).
- Tactics for saving time when writing proofs, with tactics to
asserts hypotheses or sub-goals, and improved tactics for
clearing, renaming, and sorting hypotheses.
*)
(** 提供するメインの機能は:
- 仮定の名前付けのためのより便利な構文と、それに関する導入(introduction)
と反転(inversion)のタクティック。
それらのタクティックは、すべての変数の名前は必要とせず、
型[Prop]の仮定の名前だけを入力とします。
- N-引数の連言、選言、存在限量の扱いをサポートするタクティック。
背後にある実装が二項述語をベースにしていることを隠蔽します。
- 自動化の便利なサポート。タクティックの後に"~"または"*"を付けると、
生成されたサブゴールについて自動処理を行います。
記号"~"は[auto]を、"*"は [intuition eauto] を行います。
これらはカスタマイズできます。
- 補題を、変数、仮定、あるいはその両方を使って具体化するための、
前方連鎖のタクティックが提供されます。
- [apply]のより強力な実装が提供されます([refine]をベースにしているので、
変換(conversion)に関してより良い振る舞いをします)。
- 従来の反転(inversion)のメカニズムで生成される変数の等式を置換する、
改良版の反転タクティック。さらに、依存型の等式の除去もサポートします
(これは Proof Irrelevance の弱い形である公理[K]を必要とします)。
- 証明記述の時間を節約するためのタクティック。
それには、仮定やサブゴールを主張するタクティックや、
仮定を除去したり、仮定の名前や順番を変えたりするタクティックの改良版があります。
*)
(* External credits:
- thanks to Xavier Leroy for providing the idea of tactic [forward],
- thanks to Georges Gonthier for the implementation trick in [rapply],
*)
(** 追加のクレジット:
- タクティック[forward]のアイデアの提供に関して、Xavier Leroy に感謝します
- [rapply]の実装のトリックに関して、Georges Gonthier に感謝します
*)
Set Implicit Arguments.
(* ********************************************************************** *)
(* * Additional notations for Coq *)
(** * Coqのための追加の記法 *)
(* ---------------------------------------------------------------------- *)
(* ** N-ary Existentials *)
(** ** N変数の存在限量 *)
(* [exists T1 ... TN, P] is a shorthand for
[exists T1, ..., exists TN, P]. Note that
[Coq.Program.Syntax] already defines exists
for arity up to 4. *)
(** [exists T1 ... TN, P] は
[exists T1, ..., exists TN, P] の略記法です。
なお、
[Coq.Program.Syntax] は既に4つまでの変数の存在限量を定義しています。*)
Notation "'exists' x1 ',' P" :=
(exists x1, P)
(at level 200, x1 ident,
right associativity) : type_scope.
Notation "'exists' x1 x2 ',' P" :=
(exists x1, exists x2, P)
(at level 200, x1 ident, x2 ident,
right associativity) : type_scope.
Notation "'exists' x1 x2 x3 ',' P" :=
(exists x1, exists x2, exists x3, P)
(at level 200, x1 ident, x2 ident, x3 ident,
right associativity) : type_scope.
Notation "'exists' x1 x2 x3 x4 ',' P" :=
(exists x1, exists x2, exists x3, exists x4, P)
(at level 200, x1 ident, x2 ident, x3 ident, x4 ident,
right associativity) : type_scope.
Notation "'exists' x1 x2 x3 x4 x5 ',' P" :=
(exists x1, exists x2, exists x3, exists x4, exists x5, P)
(at level 200, x1 ident, x2 ident, x3 ident, x4 ident, x5 ident,
right associativity) : type_scope.
Notation "'exists' x1 x2 x3 x4 x5 x6 ',' P" :=
(exists x1, exists x2, exists x3, exists x4, exists x5, exists x6, P)
(at level 200, x1 ident, x2 ident, x3 ident, x4 ident, x5 ident,
x6 ident,
right associativity) : type_scope.
Notation "'exists' x1 x2 x3 x4 x5 x6 x7 ',' P" :=
(exists x1, exists x2, exists x3, exists x4, exists x5, exists x6,
exists x7, P)
(at level 200, x1 ident, x2 ident, x3 ident, x4 ident, x5 ident,
x6 ident, x7 ident,
right associativity) : type_scope.
Notation "'exists' x1 x2 x3 x4 x5 x6 x7 x8 ',' P" :=
(exists x1, exists x2, exists x3, exists x4, exists x5, exists x6,
exists x7, exists x8, P)
(at level 200, x1 ident, x2 ident, x3 ident, x4 ident, x5 ident,
x6 ident, x7 ident, x8 ident,
right associativity) : type_scope.
Notation "'exists' x1 x2 x3 x4 x5 x6 x7 x8 x9 ',' P" :=
(exists x1, exists x2, exists x3, exists x4, exists x5, exists x6,
exists x7, exists x8, exists x9, P)
(at level 200, x1 ident, x2 ident, x3 ident, x4 ident, x5 ident,
x6 ident, x7 ident, x8 ident, x9 ident,
right associativity) : type_scope.
Notation "'exists' x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 ',' P" :=
(exists x1, exists x2, exists x3, exists x4, exists x5, exists x6,
exists x7, exists x8, exists x9, exists x10, P)
(at level 200, x1 ident, x2 ident, x3 ident, x4 ident, x5 ident,
x6 ident, x7 ident, x8 ident, x9 ident, x10 ident,
right associativity) : type_scope.
(* ********************************************************************** *)
(* * Tools for programming with Ltac *)
(** * Ltacによるプログラミングのための道具類 *)
(* ---------------------------------------------------------------------- *)
(* ** Identity continuation *)
(** ** 等価継続 *)
Ltac idcont tt :=
idtac.
(* ---------------------------------------------------------------------- *)
(* ** Untyped arguments for tactics *)
(** ** タクティックの型付けされない引数 *)
(* Any Coq value can be boxed into the type [Boxer]. This is
useful to use Coq computations for implementing tactics. *)
(** 任意のCoqの値は型[Boxer]に収めることができます。
これは、タクティックを実装するためのCoqの計算に便利です。 *)
Inductive Boxer : Type :=
| boxer : forall (A:Type), A -> Boxer.
(* ---------------------------------------------------------------------- *)
(* ** Optional arguments for tactics *)
(** ** タクティックのオプショナルな引数 *)
(* [ltac_no_arg] is a constant that can be used to simulate
optional arguments in tactic definitions.
Use [mytactic ltac_no_arg] on the tactic invokation,
and use [match arg with ltac_no_arg => ..] or
[match type of arg with ltac_No_arg => ..] to
test whether an argument was provided. *)
(** [ltac_no_arg]は、タクティックの定義の中で、
オプショナルな引数をシミュレートするのに使うことができる定数です。
タクティックの呼び出しには [mytactic ltac_no_arg] とします。
また、引数が与えられたかどうかをテストするためには
[match arg with ltac_no_arg => ..] または
[match type of arg with ltac_No_arg => ..] とします。 *)
Inductive ltac_No_arg : Set :=
| ltac_no_arg : ltac_No_arg.
(* ---------------------------------------------------------------------- *)
(* ** Wildcard arguments for tactics *)
(** ** タクティックのワイルドカード引数 *)
(* [ltac_wild] is a constant that can be used to simulate
wildcard arguments in tactic definitions. Notation is [__]. *)
(** [ltac_wild]は、タクティックの定義の中で、
ワイルドカード引数をシミュレートするのに使うことができる定数です。
記法は [__] です。 *)
Inductive ltac_Wild : Set :=
| ltac_wild : ltac_Wild.
Notation "'__'" := ltac_wild : ltac_scope.
(* [ltac_wilds] is another constant that is typically used to
simulate a sequence of [N] wildcards, with [N] chosen
appropriately depending on the context. Notation is [___]. *)
(** [ltac_wilds]は、典型的には[N]個のワイルドカードの列をシミュレートするのに使う定数です。
ここで[N]はコンテキストに依存して適切に選ばれます。記法は [___] です。 *)
Inductive ltac_Wilds : Set :=
| ltac_wilds : ltac_Wilds.
Notation "'___'" := ltac_wilds : ltac_scope.
Open Scope ltac_scope.
(* ---------------------------------------------------------------------- *)
(* ** Position markers *)
(** ** ポジションマーカ *)
(* [ltac_Mark] and [ltac_mark] are dummy definitions used as sentinel
by tactics, to mark a certain position in the context or in the goal. *)
(** [ltac_Mark]と[ltac_mark]は、コンテキストまたはゴールにおいて、
特定のポジションにマークをつけるために、
タクティックが使う標識のダミーの定義です。*)
Inductive ltac_Mark : Type :=
| ltac_mark : ltac_Mark.
(* [gen_until_mark] repeats [generalize] on hypotheses from the
context, starting from the bottom and stopping as soon as reaching
an hypothesis of type [Mark]. If fails if [Mark] does not
appear in the context. *)
(** [gen_until_mark]はコンテキストの一番下の仮定から型[Mark]の仮定に逹するまで
[generalize]を繰り返します。
コンテキストに[Mark]が現れないときは失敗します。 *)
Ltac gen_until_mark :=
match goal with H: ?T |- _ =>
match T with
| ltac_Mark => clear H
| _ => generalize H; clear H; gen_until_mark
end end.
(* [intro_until_mark] repeats [intro] until reaching an hypothesis of
type [Mark]. It throws away the hypothesis [Mark].
It fails if [Mark] does not appear as an hypothesis in the
goal. *)
(** [intro_until_mark]は型[Mark]の仮定に逹するまで[intro]を繰り返します。
そしてその仮定[Mark]を廃棄します。
ゴールの仮定に[Mark]が現れないときには失敗します。 *)
Ltac intro_until_mark :=
match goal with
| |- (ltac_Mark -> _) => intros _
| _ => intro; intro_until_mark
end.
(* ---------------------------------------------------------------------- *)
(* ** List of arguments for tactics *)
(** ** タクティックの引数のリスト *)
(* A datatype of type [list Boxer] is used to manipulate list of
Coq values in ltac. Notation is [>> v1 v2 ... vN] for building
a list containing the values [v1] through [vN]. *)
(** 型[list Boxer]の datatype は ltac でCoqの値のリストを扱うために使われます。
記法は [>> v1 v2 ... vN] で値[v1]から[vN]までを含むリストを作ります。 *)
Require Import List.
Notation "'>>'" :=
(@nil Boxer)
(at level 0)
: ltac_scope.
Notation "'>>' v1" :=
((boxer v1)::nil)
(at level 0, v1 at level 0)
: ltac_scope.
Notation "'>>' v1 v2" :=
((boxer v1)::(boxer v2)::nil)
(at level 0, v1 at level 0, v2 at level 0)
: ltac_scope.
Notation "'>>' v1 v2 v3" :=
((boxer v1)::(boxer v2)::(boxer v3)::nil)
(at level 0, v1 at level 0, v2 at level 0, v3 at level 0)
: ltac_scope.
Notation "'>>' v1 v2 v3 v4" :=
((boxer v1)::(boxer v2)::(boxer v3)::(boxer v4)::nil)
(at level 0, v1 at level 0, v2 at level 0, v3 at level 0,
v4 at level 0)
: ltac_scope.
Notation "'>>' v1 v2 v3 v4 v5" :=
((boxer v1)::(boxer v2)::(boxer v3)::(boxer v4)::(boxer v5)::nil)
(at level 0, v1 at level 0, v2 at level 0, v3 at level 0,
v4 at level 0, v5 at level 0)
: ltac_scope.
Notation "'>>' v1 v2 v3 v4 v5 v6" :=
((boxer v1)::(boxer v2)::(boxer v3)::(boxer v4)::(boxer v5)
::(boxer v6)::nil)
(at level 0, v1 at level 0, v2 at level 0, v3 at level 0,
v4 at level 0, v5 at level 0, v6 at level 0)
: ltac_scope.
Notation "'>>' v1 v2 v3 v4 v5 v6 v7" :=
((boxer v1)::(boxer v2)::(boxer v3)::(boxer v4)::(boxer v5)
::(boxer v6)::(boxer v7)::nil)
(at level 0, v1 at level 0, v2 at level 0, v3 at level 0,
v4 at level 0, v5 at level 0, v6 at level 0, v7 at level 0)
: ltac_scope.
Notation "'>>' v1 v2 v3 v4 v5 v6 v7 v8" :=
((boxer v1)::(boxer v2)::(boxer v3)::(boxer v4)::(boxer v5)
::(boxer v6)::(boxer v7)::(boxer v8)::nil)
(at level 0, v1 at level 0, v2 at level 0, v3 at level 0,
v4 at level 0, v5 at level 0, v6 at level 0, v7 at level 0,
v8 at level 0)
: ltac_scope.
Notation "'>>' v1 v2 v3 v4 v5 v6 v7 v8 v9" :=
((boxer v1)::(boxer v2)::(boxer v3)::(boxer v4)::(boxer v5)
::(boxer v6)::(boxer v7)::(boxer v8)::(boxer v9)::nil)
(at level 0, v1 at level 0, v2 at level 0, v3 at level 0,
v4 at level 0, v5 at level 0, v6 at level 0, v7 at level 0,
v8 at level 0, v9 at level 0)
: ltac_scope.
Notation "'>>' v1 v2 v3 v4 v5 v6 v7 v8 v9 v10" :=
((boxer v1)::(boxer v2)::(boxer v3)::(boxer v4)::(boxer v5)
::(boxer v6)::(boxer v7)::(boxer v8)::(boxer v9)::(boxer v10)::nil)
(at level 0, v1 at level 0, v2 at level 0, v3 at level 0,
v4 at level 0, v5 at level 0, v6 at level 0, v7 at level 0,
v8 at level 0, v9 at level 0, v10 at level 0)
: ltac_scope.
Notation "'>>' v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11" :=
((boxer v1)::(boxer v2)::(boxer v3)::(boxer v4)::(boxer v5)
::(boxer v6)::(boxer v7)::(boxer v8)::(boxer v9)::(boxer v10)
::(boxer v11)::nil)
(at level 0, v1 at level 0, v2 at level 0, v3 at level 0,
v4 at level 0, v5 at level 0, v6 at level 0, v7 at level 0,
v8 at level 0, v9 at level 0, v10 at level 0, v11 at level 0)
: ltac_scope.
Notation "'>>' v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12" :=
((boxer v1)::(boxer v2)::(boxer v3)::(boxer v4)::(boxer v5)
::(boxer v6)::(boxer v7)::(boxer v8)::(boxer v9)::(boxer v10)
::(boxer v11)::(boxer v12)::nil)
(at level 0, v1 at level 0, v2 at level 0, v3 at level 0,
v4 at level 0, v5 at level 0, v6 at level 0, v7 at level 0,
v8 at level 0, v9 at level 0, v10 at level 0, v11 at level 0,
v12 at level 0)
: ltac_scope.
Notation "'>>' v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13" :=
((boxer v1)::(boxer v2)::(boxer v3)::(boxer v4)::(boxer v5)
::(boxer v6)::(boxer v7)::(boxer v8)::(boxer v9)::(boxer v10)
::(boxer v11)::(boxer v12)::(boxer v13)::nil)
(at level 0, v1 at level 0, v2 at level 0, v3 at level 0,
v4 at level 0, v5 at level 0, v6 at level 0, v7 at level 0,
v8 at level 0, v9 at level 0, v10 at level 0, v11 at level 0,
v12 at level 0, v13 at level 0)
: ltac_scope.
(* The tactic [list_boxer_of] inputs a term [E] and returns a term
of type "list boxer", according to the following rules:
- if [E] is already of type "list Boxer", then it returns [E];
- otherwise, it returns the list [(boxer E)::nil]. *)
(** タクティック[list_boxer_of]は項[E]を入力し、次の規則に従って型 "list boxer"
の項を返します:
- もし[E]が既に型"list Boxer"ならば[E]を返す;
- そうでなければリスト [(boxer E)::nil] を返す。 *)
Ltac list_boxer_of E :=
match type of E with
| List.list Boxer => constr:(E)
| _ => constr:((boxer E)::nil)
end.
(* ---------------------------------------------------------------------- *)
(* ** Databases of lemmas *)
(** ** 補題のデータベース *)
(* Use the hint facility to implement a database mapping
terms to terms. To declare a new database, use a definition:
[Definition mydatabase := True.]
Then, to map [mykey] to [myvalue], write the hint:
[Hint Extern 1 (Register mydatabase mykey) => Provide myvalue.]
Finally, to query the value associated with a key, run the
tactic [ltac_database_get mydatabase mykey]. This will leave
at the head of the goal the term [myvalue]. It can then be
named and exploited using [intro]. *)
(** 項を項へマップするデータベースを実装するために、ヒント機構を使います。
新しいデータベースを宣言するには定義 [Definition mydatabase := True.]
を使います。
そして、[mykey]を[myvalue]にマップするには、次のヒントを記述します:
[Hint Extern 1 (Register mydatabase mykey) => Provide myvalue.]
最後に、キーに関連付けられた値を問合わせるには、
タクティック[ltac_database_get mydatabase mykey]を走らせます。
そうするとゴールの先頭に項[myvalue]が置かれます。
すると[intro]によって指名し利用できます。 *)
Definition ltac_database (D:Boxer) (T:Boxer) (A:Boxer) := True.
Notation "'Register' D T" := (ltac_database (boxer D) (boxer T) _)
(at level 69, D at level 0, T at level 0).
Lemma ltac_database_provide : forall (A:Boxer) (D:Boxer) (T:Boxer),
ltac_database D T A.
Proof. split. Qed.
Ltac Provide T := apply (@ltac_database_provide (boxer T)).
Ltac ltac_database_get D T :=
let A := fresh "TEMP" in evar (A:Boxer);
let H := fresh "TEMP" in
assert (H : ltac_database (boxer D) (boxer T) A);
[ subst A; auto
| subst A; match type of H with ltac_database _ _ (boxer ?L) =>
generalize L end; clear H ].
(* ---------------------------------------------------------------------- *)
(* ** On-the-fly removal of hypotheses *)
(** ** その場での仮定の除去 *)
(* In a list of arguments [>> H1 H2 .. HN] passed to a tactic
such as [lets] or [applys] or [forwards] or [specializes],
the term [rm], an identity function, can be placed in front
of the name of an hypothesis to be deleted. *)
(** [lets]、[applys]、[forwards]、[specializes]
などのタクティックに渡される引数のリスト [>> H1 H2 .. HN] において、
恒等関数である項[rm]を消去すべき仮定の名前の前に置くことができます。 *)
Definition rm (A:Type) (X:A) := X.
(* [rm_term E] removes one hypothesis that admits the same
type as [E]. *)
(** [rm_term E] は[E]と同じ型と認められる仮定を除去します。 *)
Ltac rm_term E :=
let T := type of E in
match goal with H: T |- _ => try clear H end.
(* [rm_inside E] calls [rm_term Ei] for any subterm
of the form [rm Ei] found in E *)
(** [rm_inside E] は [rm Ei] という形の[E]の任意の部分項に対して
[rm_term Ei] を呼びます。 *)
Ltac rm_inside E :=
let go E := rm_inside E in
match E with
| rm ?X => rm_term X
| ?X1 ?X2 =>
go X1; go X2
| ?X1 ?X2 ?X3 =>
go X1; go X2; go X3
| ?X1 ?X2 ?X3 ?X4 =>
go X1; go X2; go X3; go X4
| ?X1 ?X2 ?X3 ?X4 ?X5 =>
go X1; go X2; go X3; go X4; go X5
| ?X1 ?X2 ?X3 ?X4 ?X5 ?X6 =>
go X1; go X2; go X3; go X4; go X5; go X6
| ?X1 ?X2 ?X3 ?X4 ?X5 ?X6 ?X7 =>
go X1; go X2; go X3; go X4; go X5; go X6; go X7
| ?X1 ?X2 ?X3 ?X4 ?X5 ?X6 ?X7 ?X8 =>
go X1; go X2; go X3; go X4; go X5; go X6; go X7; go X8
| ?X1 ?X2 ?X3 ?X4 ?X5 ?X6 ?X7 ?X8 ?X9 =>
go X1; go X2; go X3; go X4; go X5; go X6; go X7; go X8; go X9
| ?X1 ?X2 ?X3 ?X4 ?X5 ?X6 ?X7 ?X8 ?X9 ?X10 =>
go X1; go X2; go X3; go X4; go X5; go X6; go X7; go X8; go X9; go X10
| _ => idtac
end.
(* For faster performance, one may deactivate [rm_inside] by
replacing the body of this definition with [idtac]. *)
(** パフォーマンスを上げるために[rm_inside]を非アクティブ化するには、
次の定義の本体を[idtac]に置換してください。 *)
Ltac fast_rm_inside E :=
rm_inside E.
(* ---------------------------------------------------------------------- *)
(* ** Numbers as arguments *)
(** ** 引数としての数値 *)
(* When tactic takes a natural number as argument, it may be
parsed either as a natural number or as a relative number.
In order for tactics to convert their arguments into natural numbers,
we provide a conversion tactic. *)
(** タクティックが自然数を引数としてとるとき、
自然数として構文解析される可能性と相対値として構文解析される可能性があります。
タクティックが引数を自然数に変換するために、変換タクティックを提供します。 *)
Require Coq.NArith.BinPos Coq.ZArith.BinInt.
Definition ltac_nat_from_int (x:BinInt.Z) : nat :=
match x with
| BinInt.Z0 => 0%nat
| BinInt.Zpos p => BinPos.nat_of_P p
| BinInt.Zneg p => 0%nat
end.
Ltac nat_from_number N :=
match type of N with
| nat => constr:(N)
| BinInt.Z => let N' := constr:(ltac_nat_from_int N) in eval compute in N'
end.
(* [ltac_pattern E at K] is the same as [pattern E at K] except that
[K] is a Coq natural rather than a Ltac integer. Syntax
[ltac_pattern E as K in H] is also available. *)
(** [ltac_pattern E at K]は [pattern E at K] と同様ですが、
[K] が Ltac の整数ではなく Coq の自然数である点が違います。
構文 [ltac_pattern E as K in H] も可能です。*)
Tactic Notation "ltac_pattern" constr(E) "at" constr(K) :=
match nat_from_number K with
| 1 => pattern E at 1
| 2 => pattern E at 2
| 3 => pattern E at 3
| 4 => pattern E at 4
| 5 => pattern E at 5
| 6 => pattern E at 6
| 7 => pattern E at 7
| 8 => pattern E at 8
end.
Tactic Notation "ltac_pattern" constr(E) "at" constr(K) "in" hyp(H) :=
match nat_from_number K with
| 1 => pattern E at 1 in H
| 2 => pattern E at 2 in H
| 3 => pattern E at 3 in H
| 4 => pattern E at 4 in H
| 5 => pattern E at 5 in H
| 6 => pattern E at 6 in H
| 7 => pattern E at 7 in H
| 8 => pattern E at 8 in H
end.
(* ---------------------------------------------------------------------- *)
(* ** Testing tactics *)
(** ** タクティックをテストする *)
(* [show tac] executes a tactic [tac] that produces a result,
and then display its result. *)
(** [show tac] はタクティック[tac]を実行し、その結果を表示します。*)
Tactic Notation "show" tactic(tac) :=
let R := tac in pose R.
(* [dup N] produces [N] copies of the current goal. It is useful
for building examples on which to illustrate behaviour of tactics.
[dup] is short for [dup 2]. *)
(** [dup N] は現在のゴールの[N]個のコピーを作ります。
これは、タクティックのふるまいを示す例を作るのに便利です。
[dup]は [dup 2] の略記法です。 *)
Lemma dup_lemma : forall P, P -> P -> P.
Proof. auto. Qed.
Ltac dup_tactic N :=
match nat_from_number N with
| 0 => idtac
| S 0 => idtac
| S ?N' => apply dup_lemma; [ | dup_tactic N' ]
end.
Tactic Notation "dup" constr(N) :=
dup_tactic N.
Tactic Notation "dup" :=
dup 2.
(* ---------------------------------------------------------------------- *)
(* ** Check no evar in goal *)
(** ** ゴールにやり残しがないことのチェック *)
Ltac check_noevar M :=
match M with M => idtac end.
Ltac check_noevar_hyp H := (* todo: imlement using check_noevar *)
let T := type of H in
match type of H with T => idtac end.
Ltac check_noevar_goal := (* todo: imlement using check_noevar *)
match goal with |- ?G => match G with G => idtac end end.
(* ---------------------------------------------------------------------- *)
(* ** Tagging of hypotheses *)
(** ** 仮定のタグ付け *)
(* [get_last_hyp tt] is a function that returns the last hypothesis
at the bottom of the context. It is useful to obtain the default
name associated with the hypothesis, e.g.
[intro; let H := get_last_hyp tt in let H' := fresh "P" H in ...] *)
(** [get_last_hyp tt] はコンテキストの一番下の最後の仮定を返す関数です。
仮定に付けられたデフォルトの名前を得るのに便利です。例えば:
[intro; let H := get_last_hyp tt in let H' := fresh "P" H in ...] *)
Ltac get_last_hyp tt :=
match goal with H: _ |- _ => constr:(H) end.
(* ---------------------------------------------------------------------- *)
(* ** Tagging of hypotheses *)
(** ** 仮定のタグ付け *)
(* [ltac_tag_subst] is a specific marker for hypotheses
which is used to tag hypotheses that are equalities to
be substituted. *)
(** [ltac_tag_subst]は置換対象の等式である仮定にタグ付けするのに使われる特別なマーカです。*)
Definition ltac_tag_subst (A:Type) (x:A) := x.
(* [ltac_to_generalize] is a specific marker for hypotheses
to be generalized. *)
(** [ltac_to_generalize]は一般化する仮定のための特別なマーカです。 *)
Definition ltac_to_generalize (A:Type) (x:A) := x.
Ltac gen_to_generalize :=
repeat match goal with
H: ltac_to_generalize _ |- _ => generalize H; clear H end.
Ltac mark_to_generalize H :=
let T := type of H in
change T with (ltac_to_generalize T) in H.
(* ---------------------------------------------------------------------- *)
(* ** Deconstructing terms *)
(** ** 項を解体する *)
(* [get_head E] is a tactic that returns the head constant of the
term [E], ie, when applied to a term of the form [P x1 ... xN]
it returns [P]. If [E] is not an application, it returns [E].
Warning: the tactic seems to loop in some cases when the goal is
a product and one uses the result of this function. *)
(** [get_head E] は項[E]の冒頭の定数を返すタクティックです。
つまり、[P x1 ... xN] という形の項に適用されると[P]を返します。
[E]が適用の形ではないときには、[E]を返します。
注意: このタクティックは、ゴールが積で、
この関数の結果を使う処理がある場合にループすることがあります。
(訳注: このファイル中での積(product)は、他のファイルとは異なり(?)
Coq のマニュアルの product のことです。含意または全称限量のことを指します。
[Logic_J.v]の冒頭で、[->] と [forall] が同じだと言っていますが、
これらのことです。)
*)
Ltac get_head E :=
match E with
| ?P _ _ _ _ _ _ _ _ _ _ _ _ => constr:(P)
| ?P _ _ _ _ _ _ _ _ _ _ _ => constr:(P)
| ?P _ _ _ _ _ _ _ _ _ _ => constr:(P)
| ?P _ _ _ _ _ _ _ _ _ => constr:(P)
| ?P _ _ _ _ _ _ _ _ => constr:(P)
| ?P _ _ _ _ _ _ _ => constr:(P)
| ?P _ _ _ _ _ _ => constr:(P)
| ?P _ _ _ _ _ => constr:(P)
| ?P _ _ _ _ => constr:(P)
| ?P _ _ _ => constr:(P)
| ?P _ _ => constr:(P)
| ?P _ => constr:(P)
| ?P => constr:(P)
end.
(* [get_fun_arg E] is a tactic that decomposes an application
term [E], ie, when applied to a term of the form [X1 ... XN]
it returns a pair made of [X1 .. X(N-1)] and [XN]. *)
(** [get_fun_arg E] は適用項[E]の分解をするタクティックです。
つまり、[X1 ... XN] という形の項に適用されると [X1 .. X(N-1)] と [XN]
の対を返します。 *)
Ltac get_fun_arg E :=
match E with
| ?X1 ?X2 ?X3 ?X4 ?X5 ?X6 ?X7 ?X => constr:((X1 X2 X3 X4 X5 X6,X))
| ?X1 ?X2 ?X3 ?X4 ?X5 ?X6 ?X => constr:((X1 X2 X3 X4 X5,X))
| ?X1 ?X2 ?X3 ?X4 ?X5 ?X => constr:((X1 X2 X3 X4,X))
| ?X1 ?X2 ?X3 ?X4 ?X => constr:((X1 X2 X3,X))
| ?X1 ?X2 ?X3 ?X => constr:((X1 X2,X))
| ?X1 ?X2 ?X => constr:((X1,X))
| ?X1 ?X => constr:((X1,X))
end.
(* ---------------------------------------------------------------------- *)
(* ** Action at occurence and action not at occurence *)
(** ** 出現場所でのアクションと出現場所以外でのアクション *)
(* [ltac_action_at K of E do Tac] isolates the [K]-th occurence of [E] in the
goal, setting it in the form [P E] for some named pattern [P],
then calls tactic [Tac], and finally unfolds [P]. Syntax
[ltac_action_at K of E in H do Tac] is also available. *)
(** [ltac_action_at K of E do Tac] はゴールにおける[E]の[K]番目の出現を区別し、
それを指定されたパターン[P]によって [P E] の形にセットしてタクティック[Tac]を呼び、
最後に[P]を unfold します。
構文 [ltac_action_at K of E in H do Tac] も可能です。 *)
Tactic Notation "ltac_action_at" constr(K) "of" constr(E) "do" tactic(Tac) :=
let p := fresh in ltac_pattern E at K;
match goal with |- ?P _ => set (p:=P) end;
Tac; unfold p; clear p.
Tactic Notation "ltac_action_at" constr(K) "of" constr(E) "in" hyp(H) "do" tactic(Tac) :=
let p := fresh in ltac_pattern E at K in H;
match type of H with ?P _ => set (p:=P) in H end;
Tac; unfold p in H; clear p.
(* [protects E do Tac] temporarily assigns a name to the expression [E]
so that the execution of tactic [Tac] will not modify [E]. This is
useful for instance to restrict the action of [simpl]. *)
(** [protects E do Tac] は式[E]に一時的に名前を与えることで、
タクティック[Tac]の実行が[E]を変更しないようにします。
これは例えば[simpl]のアクションを制限するのに便利です。 *)
Tactic Notation "protects" constr(E) "do" tactic(Tac) :=
(* let x := fresh "TEMP" in sets_eq x: E; T; subst x. *)
let x := fresh "TEMP" in let H := fresh "TEMP" in
set (X := E) in *; assert (H : X = E) by reflexivity;
clearbody X; Tac; subst x.
Tactic Notation "protects" constr(E) "do" tactic(Tac) "/" :=
protects E do Tac.
(* ---------------------------------------------------------------------- *)
(* ** An alias for [eq] *)
(** ** [eq]の別名 *)
(* [eq'] is an alias for [eq] to be used for equalities in
inductive definitions, so that they don't get mixed with
equalities generated by [inversion]. *)
(** [eq']は帰納的定義の等式で使うための[eq]の別名で、
これにより、[inversion]によって生成される等式と混ざるのを防ぐことができます。 *)
Definition eq' := @eq.
Hint Unfold eq'.
Notation "x '='' y" := (@eq' _ x y)
(at level 70, arguments at next level).
(* ********************************************************************** *)
(* * Backward and forward chaining *)
(** * 後方/前方連鎖 *)
(* ---------------------------------------------------------------------- *)
(* ** Application *)
(** ** 適用(Application) *)
(* [rapply] is a tactic similar to [eapply] except that it is
based on the [refine] tactics, and thus is strictly more
powerful (at least in theory :). In short, it is able to perform
on-the-fly conversions when required for arguments to match,
and it is able to instantiate existentials when required. *)
(** [rapply]は[eapply]と同様のタクティックですが、[refine]
タクティックに基づいている点が違います。そしてこのために、
(少なくとも理論的には :)より強力です。
簡単に言うと、引数がマッチするために必要となる変換をその場で行うことができます。
また必要なときに存在変数を具体化できます。 *)
Tactic Notation "rapply" constr(t) :=
first (* todo: les @ sont inutiles *)
[ eexact (@t)
| refine (@t)
| refine (@t _)
| refine (@t _ _)
| refine (@t _ _ _)
| refine (@t _ _ _ _)
| refine (@t _ _ _ _ _)
| refine (@t _ _ _ _ _ _)
| refine (@t _ _ _ _ _ _ _)
| refine (@t _ _ _ _ _ _ _ _)
| refine (@t _ _ _ _ _ _ _ _ _)
| refine (@t _ _ _ _ _ _ _ _ _ _)
| refine (@t _ _ _ _ _ _ _ _ _ _ _)
| refine (@t _ _ _ _ _ _ _ _ _ _ _ _)
| refine (@t _ _ _ _ _ _ _ _ _ _ _ _ _)
| refine (@t _ _ _ _ _ _ _ _ _ _ _ _ _ _)
| refine (@t _ _ _ _ _ _ _ _ _ _ _ _ _ _ _)
].
(* The tactics [applys_N T], where [N] is a natural number,
provides a more efficient way of using [applys T]. It avoids
trying out all possible arities, by specifying explicitely
the arity of function [T]. *)
(** 自然数[N]について、タクティック [applys_N T] は
[applys T] をより効果的に使う方法を提供します。
関数[T]の引数の数(アリティ、arity)を明示的に指定することで、
すべての可能なアリティを試してみることを避けます。 *)
Tactic Notation "rapply_0" constr(t) :=
refine (@t).
Tactic Notation "rapply_1" constr(t) :=
refine (@t _).
Tactic Notation "rapply_2" constr(t) :=
refine (@t _ _).
Tactic Notation "rapply_3" constr(t) :=
refine (@t _ _ _).
Tactic Notation "rapply_4" constr(t) :=
refine (@t _ _ _ _).
Tactic Notation "rapply_5" constr(t) :=
refine (@t _ _ _ _ _).
Tactic Notation "rapply_6" constr(t) :=
refine (@t _ _ _ _ _ _).
Tactic Notation "rapply_7" constr(t) :=
refine (@t _ _ _ _ _ _ _).
Tactic Notation "rapply_8" constr(t) :=
refine (@t _ _ _ _ _ _ _ _).
Tactic Notation "rapply_9" constr(t) :=
refine (@t _ _ _ _ _ _ _ _ _).
Tactic Notation "rapply_10" constr(t) :=
refine (@t _ _ _ _ _ _ _ _ _ _).
(* [lets_base H E] adds an hypothesis [H : T] to the context, where [T] is
the type of term [E]. If [H] is an introduction pattern, it will
destruct [H] according to the pattern. *)
(** [lets_base H E] は仮定 [H : T] をコンテキストに追加します。ここで
[T]は項[E]の型です。もし[H]が導入パターンなら、パターンに従って[H]を分解します。 *)
Ltac lets_base I E := generalize E; intros I.
(* [applys_to H E] transform the type of hypothesis [H] by
replacing it by the result of the application of the term
[E] to [H]. Intuitively, it is equivalent to [lets H: (E H)]. *)
(** [applys_to H E] は、仮定[H]を、項[E]を[H]に適用した結果で置換することで、
仮定の型を変換します。直観的には、[lets H: (E H)] と同値です。 *)
Tactic Notation "applys_to" hyp(H) constr(E) :=
let H' := fresh in rename H into H';
(first [ lets_base H (E H')
| lets_base H (E _ H')
| lets_base H (E _ _ H')
| lets_base H (E _ _ _ H')
| lets_base H (E _ _ _ _ H')
| lets_base H (E _ _ _ _ _ H')
| lets_base H (E _ _ _ _ _ _ H')
| lets_base H (E _ _ _ _ _ _ _ H')
| lets_base H (E _ _ _ _ _ _ _ _ H')
| lets_base H (E _ _ _ _ _ _ _ _ _ H') ]
); clear H'.
(* [constructors] calls [constructor] or [econstructor]. *)
(** [constructors]は[constructor]または[econstructor]を呼びます。 *)
Tactic Notation "constructors" :=
first [ constructor | econstructor ]; unfold eq'.
(* ---------------------------------------------------------------------- *)
(* ** Assertions *)
(** ** 表明(Assertions) *)
(* [false_goal] replaces any goal by the goal [False].
Contrary to the tactic [false] (below), it does not try to do
anything else *)
(** [false_goal]は任意のゴールを[False]で置換します。
タクティック[false](後述)と対照的に、特に何もしようとしません。*)
Tactic Notation "false_goal" :=
elimtype False.
(* [false_post] is the underlying tactic used to prove goals
of the form [False]. In the default implementation, it proves
the goal if the context contains [False] or an hypothesis of the
form [C x1 .. xN = D y1 .. yM], or if the [congruence] tactic
finds a proof of [x <> x] for some [x]. *)
(** [false_post]は[False]の形のゴールを証明するときに背後で使われるタクティックです。
デフォルトの実装ではコンテキストが[False]か、または[C x1 .. xN = D y1 .. yM]
という形の仮定を含む場合、あるいは[congruence]タクティックがある[x]について
[x <> x] の証明を見つけた場合にゴールを証明します。 *)
Ltac false_post :=
solve [ assumption | discriminate | congruence ].
(* [false] replaces any goal by the goal [False], and calls [false_post] *)
(** [false]は任意のゴールを[False]に置換し、[false_post]を呼びます。 *)
Tactic Notation "false" :=
false_goal; try false_post.
(* [tryfalse] tries to solve a goal by contradiction, and leaves
the goal unchanged if it cannot solve it.
It is equivalent to [try solve \[ false \]]. *)
(** [tryfalse]は矛盾によってゴールを解こうとします。
そして解けなかった場合にはゴールを変更しないまま残します。
これは [try solve \[ false \]] と同値です。 *)
Tactic Notation "tryfalse" :=
try solve [ false ].
(* [tryfalse by tac /] is that same as [tryfalse] except that
it tries to solve the goal using tactic [tac] if [assumption]
and [discriminate] do not apply.
It is equivalent to [try solve \[ false; tac \]].
Example: [tryfalse by congruence/] *)
(** [tryfalse by tac /] は[tryfalse]と同様ですが、
[assumption]と[discriminate]が適用できないとき、
タクティック[tac]を使ってゴールを解こうとする点が違います。
これは [try solve \[ false; tac \]] と同値です。
例: [tryfalse by congruence/] *)
Tactic Notation "tryfalse" "by" tactic(tac) "/" :=
try solve [ false; instantiate; tac ].
(* [false T] tries [false; apply T], or otherwise adds [T] as
an assumption and calls [false]. *)
(** [false T] は [false; apply T] を試みます。それが失敗した場合、[T]
を仮定に加え[false]を呼びます。 *)
Tactic Notation "false" constr(T) "by" tactic(tac) "/" :=
false_goal; first
[ first [ apply T | eapply T | rapply T]; instantiate; tac (* todo: sapply?*)
| let H := fresh in lets_base H T;
first [ discriminate H (* optimization *)
| false; instantiate; tac ] ].
(* todo: false (>> H X1 X2)... *)
Tactic Notation "false" constr(T) :=
false T by idtac/.
(* [false_invert] proves any goal provided there is at least
one hypothesis [H] in the context that can be proved absurd
by calling [inversion H]. *)
(** [false_invert]は、コンテキストに少なくとも1つの仮定[H]があって、
[inversion H]によって[H]が不合理(absurd)であることが証明されるとき、
任意のゴールを証明します。 *)
Ltac false_invert_tactic :=
match goal with H:_ |- _ =>
solve [ inversion H
| clear H; false_invert_tactic
| fail 2 ] end.
Tactic Notation "false_invert" :=
false_invert_tactic.
(* [tryfalse_invert] tries to prove the goal using
[false] or [false_invert], and leaves the goal
unchanged if it does not succeed. *)
(** [tryfalse_invert]は[false]と[false_invert]を使ってゴールを解こうとします。
そして失敗するときは、ゴールを変えずに残します。 *)
Tactic Notation "tryfalse_invert" :=
try solve [ false | false_invert ].
(* [asserts H: T] is another syntax for [assert (H : T)], which
also works with introduction patterns. For instance, one can write:
[asserts \[x P\] (exists n, n = 3)], or
[asserts \[H|H\] (n = 0 \/ n = 1). *)
(** [asserts H: T] は [assert (H : T)] の別構文です。
これは同様に導出パターンについてはたらきます。
例えば、次のように書くことができます:
[asserts \[x P\] (exists n, n = 3)]、あるいは
[asserts \[H|H\] (n = 0 \/ n = 1)]。 *)
Tactic Notation "asserts" simple_intropattern(I) ":" constr(T) :=
let H := fresh in assert (H : T);
[ | generalize H; clear H; intros I ].
(* [asserts H1 .. HN: T] is a shorthand for
[asserts \[H1 \[H2 \[.. HN\]\]\]\]: T]. *)
(** [asserts H1 .. HN: T] は
[asserts \[H1 \[H2 \[.. HN\]\]\]: T] の略記法です。 *)
Tactic Notation "asserts" simple_intropattern(I1)
simple_intropattern(I2) ":" constr(T) :=
asserts [I1 I2]: T.
Tactic Notation "asserts" simple_intropattern(I1)
simple_intropattern(I2) simple_intropattern(I3) ":" constr(T) :=
asserts [I1 [I2 I3]]: T.
Tactic Notation "asserts" simple_intropattern(I1)
simple_intropattern(I2) simple_intropattern(I3)
simple_intropattern(I4) ":" constr(T) :=
asserts [I1 [I2 [I3 I4]]]: T.
Tactic Notation "asserts" simple_intropattern(I1)
simple_intropattern(I2) simple_intropattern(I3)