-
Notifications
You must be signed in to change notification settings - Fork 2
/
vernac_types.py
2242 lines (1902 loc) · 68.1 KB
/
vernac_types.py
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
# Python classes corresponding to OCaml datatypes
# They are used to generate the CFG of the S-expressions, see gallina.py
from collections import OrderedDict
import re
class Type:
'Abstract class for Ocaml types'
cache = {}
def __new__(cls, *args):
if len(args) == 0:
nonterminal = cls.__name__.lower()
else:
nonterminal = (cls.__name__ + '___' + '____'.join([p.nonterminal for p in args])).lower()
if hasattr(cls, 'inline') and cls.inline == True:
nonterminal = '_' + nonterminal
if nonterminal in Type.cache:
t = Type.cache[nonterminal]
t.initialized = True
return t
else:
t = super().__new__(cls)
t.initialized = False
t.nonterminal = nonterminal
Type.cache[nonterminal] = t
return t
def parsing_rules(self):
'return a list of strings (production rules) and a list of symbols (dependencies)'
raise NotImplementedError
def to_ebnf(self, recursive=False, skip_symbols=None):
if skip_symbols is None:
skip_symbols = set()
rules, dependencies = self.parsing_rules()
ebnf = self.nonterminal + ' : ' + ('\n ' + ' ' * len(self.nonterminal) + '| ').join(rules)
skip_symbols.add('constr__constr')
if recursive:
for t in dependencies:
if not t.nonterminal in skip_symbols:
skip_symbols.add(t.nonterminal)
ebnf += '\n\n' + t.to_ebnf(True, skip_symbols)
return ebnf
def is_alias_for(self, cls):
return isinstance(self, cls)
class AliasType(Type):
def __init__(self):
self.nonterminal = self.alias.nonterminal
def is_alias_for(self, cls):
if isinstance(self, cls):
return True
else:
return self.alias.is_alias_for(cls)
def parsing_rules(self):
return self.alias.parsing_rules()
class UnimplementedType(Type):
def parsing_rules(self):
raise ValueError(self.__class__.__name__ + " unimplemented")
# built-in types
class Int(Type):
def parsing_rules(self):
return ['SIGNED_INT'], []
class String(Type):
def parsing_rules(self):
return ['ESCAPED_STRING', 'STRING_INNER*'], []
class Bool(Type):
def parsing_rules(self):
return ['"true"', '"false"'], []
class Tuple(Type):
inline = True
def __init__(self, *args):
self.types = args
def parsing_rules(self):
return ['"(" %s ")"' % ' '.join([e.nonterminal for e in self.types])], self.types
class List(Type):
inline = True
def __init__(self, t):
assert isinstance(t, Type)
self.t = t
def parsing_rules(self):
return ['"(" %s* ")"' % self.t.nonterminal], [self.t]
class Array(Type):
inline = True
def __init__(self, t):
assert isinstance(t, Type)
self.t = t
def parsing_rules(self):
return ['"(" %s* ")"' % self.t.nonterminal], [self.t]
class NonEmptyList(Type):
def __init__(self, t):
assert isinstance(t, Type)
self.t = t
def parsing_rules(self):
return ['"(" %s+ ")"' % self.t.nonterminal], [self.t]
class Record(Type):
def parsing_rules(self):
return ['"(" %s ")"' % ' '.join(['"(" /%s/ %s ")"' % (k, v.nonterminal)
for k, v in self.fields.items()])], \
[v for v in self.fields.values()]
class Variant(Type):
def parsing_rules(self):
rules = []
dependencies = []
for name, arg_type in self.constructors.items():
if arg_type is None:
rules.append('"%s" -> constructor_%s' % (name, name.lower()))
continue
elif isinstance(arg_type, Tuple):
args = ' '.join([t.nonterminal for t in arg_type.types])
dependencies.extend(arg_type.types)
else:
args = arg_type.nonterminal
dependencies.append(arg_type)
rules.append('"(" "%s" %s ")" -> constructor_%s' % (name, args, name.lower()))
return rules, dependencies
class Option(Type):
inline = True
def __init__(self, t):
assert isinstance(t, Type)
self.t = t
def parsing_rules(self):
return ['"(" %s? ")"' % self.t.nonterminal], [self.t]
# Coq types
class Univ__Universe__t(AliasType):
'''
type t = Level.t * int
'''
def __init__(self):
'coq-serapi/serlib/ser_univ.ml: type _t = (Level.t * int) list'
self.alias = List(Tuple(Univ__Level__t(), Int()))
class Sorts__t(Variant):
'''
type t =
| Prop
| Set
| Type of Univ.Universe.t
'''
def __init__(self):
self.constructors = OrderedDict({
'Prop': None,
'Set': None,
'Type': Univ__Universe__t(),
})
class Univ__Level__t(Variant):
'''
type t = {
hash : int;
data : RawLevel.t }
'''
def __init__(self):
'coq-serapi/serlib/ser_univ.ml: type _level = ULevel of int'
self.constructors = OrderedDict({
'ULevel': Int(),
})
class Univ__Instance__t(Variant):
'''
type t = Level.t array
'''
def __init__(self):
'coq-serapi/serlib/ser_univ.ml: type _instance = Instance of Level.t array'
self.constructors = OrderedDict({
'Instance': Array(Univ__Level__t()),
})
class Names__KerPair__t(Variant):
'''
type t =
| Same of KerName.t (** user = canonical *)
| Dual of KerName.t * KerName.t (** user then canonical *)
'''
def __init__(self):
self.constructors = OrderedDict({
'Same': Names__KerName__t(),
'Dual': Tuple(Names__KerName__t(), Names__KerName__t()),
})
class Names__Constant__t(Variant):
'''
module Constant = KerPair
'''
def __init__(self):
'coq-serapi/serlib/ser_names.ml: type _constant = Constant of ModPath.t * DirPath.t * Label.t'
self.constructors = OrderedDict({
'Constant': Tuple(Names__ModPath__t(), Names__DirPath__t(), Names__Label__t()),
})
class Names__MutInd__t(Variant):
'''
module MutInd = KerPair
'''
def __init__(self):
'coq-serapi/serlib/ser_names.ml: type _mutind = Mutind of ModPath.t * DirPath.t * Label.t'
self.constructors = OrderedDict({
'Mutind': Tuple(Names__ModPath__t(), Names__DirPath__t(), Names__Label__t()),
})
class Names__inductive(AliasType):
'''
(** Designation of a (particular) inductive type. *)
type inductive = MutInd.t (* the name of the inductive type *)
* int (* the position of this inductive type
within the block of mutually-recursive inductive types.
BEWARE: indexing starts from 0. *)
'''
def __init__(self):
self.alias = Tuple(Names__MutInd__t(), Int())
class Names__constructor(AliasType):
'''
(** Designation of a (particular) constructor of a (particular) inductive type. *)
type constructor = inductive (* designates the inductive type *)
* int (* the index of the constructor
BEWARE: indexing starts from 1. *)
'''
def __init__(self):
self.alias = Tuple(Names__inductive(), Int())
class Constr__case_style(Variant):
'''
type case_style = LetStyle | IfStyle | LetPatternStyle | MatchStyle | RegularStyle
'''
def __init__(self):
self.constructors = OrderedDict({
'LetStyle': None,
'IfStyle': None,
'LetPatternStyle': None,
'MatchStyle': None,
'RegularStyle': None,
})
class Constr__case_printing(Record):
'''
type case_printing =
{ ind_tags : bool list; (** tell whether letin or lambda in the arity of the inductive type *)
cstr_tags : bool list array; (* whether each pattern var of each constructor is a let-in (true) or not (false) *)
style : case_style }
'''
def __init__(self):
self.fields = OrderedDict({
'ind_tags': List(Bool()),
'cstr_tags': Array(List(Bool())),
'style': Constr__case_style(),
})
class Constr__case_info(Record):
'''
type case_info =
{ ci_ind : inductive; (* inductive type to which belongs the value that is being matched *)
ci_npar : int; (* number of parameters of the above inductive type *)
ci_cstr_ndecls : int array; (* For each constructor, the corresponding integer determines
the number of values that can be bound in a match-construct.
NOTE: parameters of the inductive type are therefore excluded from the count *)
ci_cstr_nargs : int array; (* for each constructor, the corresponding integers determines
the number of values that can be applied to the constructor,
in addition to the parameters of the related inductive type
NOTE: "lets" are therefore excluded from the count
NOTE: parameters of the inductive type are also excluded from the count *)
ci_pp_info : case_printing (* not interpreted by the kernel *)
}
'''
def __init__(self):
self.fields = OrderedDict({
'ci_ind': Names__inductive(),
'ci_npar': Int(),
'ci_cstr_ndecls': Array(Int()),
'ci_cstr_nargs': Array(Int()),
'ci_pp_info': Constr__case_printing(),
})
class Evar__t(Variant):
'''
type t = int
'''
def __init__(self):
'coq-serapi/serlib/ser_evar.ml: type _evar = Ser_Evar of int [@@deriving sexp]'
self.constructors = OrderedDict({
'Ser_Evar': Int(),
})
class Constr__existential_key(AliasType):
'''
type existential_key = Evar.t
'''
def __init__(self):
self.alias = Evar__t()
class Constr__pexistential(AliasType):
'''
type 'constr pexistential = existential_key * 'constr array
'''
def __init__(self, constr):
self.constr = constr
self.alias = Tuple(Constr__existential_key(), Array(self.constr))
class Constr__prec_declaration(AliasType):
'''
type ('constr, 'types) prec_declaration =
Name.t array * 'types array * 'constr array
'''
def __init__(self, constr, types):
self.constr = constr
self.types = types
self.alias = Tuple(Array(Names__Name__t()), Array(self.types), Array(self.constr))
class Constr__pfixpoint(AliasType):
'''
type ('constr, 'types) pfixpoint =
(int array * int) * ('constr, 'types) prec_declaration
'''
def __init__(self, constr, types):
self.constr = constr
self.types = types
self.alias = Tuple(Tuple(Array(Int()), Int()), Constr__prec_declaration(self.constr, self.types))
class Constr__pcofixpoint(AliasType):
'''
type ('constr, 'types) pcofixpoint =
int * ('constr, 'types) prec_declaration
'''
def __init__(self, constr, types):
self.constr = constr
self.types = types
self.alias = Tuple(Int(), Constr__prec_declaration(self.constr, self.types))
class Names__Projection__t(Variant):
'''
type t =
{ proj_ind : inductive;
proj_npars : int;
proj_arg : int;
proj_name : Label.t; }
'''
def __init__(self):
'coq-serapi/serlib/ser_names.ml: type _projection = Projection of Constant.t * bool'
self.constructors = OrderedDict({
'Projection': Tuple(Names__Constant__t(), Bool()),
})
class Constr__cast_kind(Variant):
'''
type cast_kind = VMcast | NATIVEcast | DEFAULTcast | REVERTcast
'''
def __init__(self):
self.constructors = OrderedDict({
'VMcast': None,
'NATIVEcast': None,
'DEFAULTcast': None,
'REVERTcast': None,
})
class Constr__metavariable(AliasType):
'''
type metavariable = int
'''
def __init__(self):
self.alias = Int()
class Constr__kind_of_term(Variant):
'''
type ('constr, 'types, 'sort, 'univs) kind_of_term =
| Rel of int
| Var of Id.t
| Meta of metavariable
| Evar of 'constr pexistential
| Sort of 'sort
| Cast of 'constr * cast_kind * 'types
| Prod of Name.t * 'types * 'types
| Lambda of Name.t * 'types * 'constr
| LetIn of Name.t * 'constr * 'types * 'constr
| App of 'constr * 'constr array
| Const of (Constant.t * 'univs)
| Ind of (inductive * 'univs)
| Construct of (constructor * 'univs)
| Case of case_info * 'constr * 'constr * 'constr array
| Fix of ('constr, 'types) pfixpoint
| CoFix of ('constr, 'types) pcofixpoint
| Proj of Projection.t * 'constr
'''
def __init__(self, constr, types, sort, univs):
self.constr = constr
self.types = types
self.sort = sort
self.univs = univs
self.constructors = OrderedDict({
'Rel': Int(),
'Var': Names__Id__t(),
'Meta': Constr__metavariable(),
'Evar': Constr__pexistential(self.constr),
'Sort': self.sort,
'Cast': Tuple(self.constr, Constr__cast_kind(), self.types),
'Prod': Tuple(Names__Name__t(), self.types, self.types),
'Lambda': Tuple(Names__Name__t(), self.types, self.constr),
'LetIn': Tuple(Names__Name__t(), self.constr, self.types, self.constr),
'App': Tuple(self.constr, Array(self.constr)),
'Const': Tuple(Tuple(Names__Constant__t(), self.univs)),
'Ind': Tuple(Tuple(Names__inductive(), self.univs)),
'Construct': Tuple(Tuple(Names__constructor(), self.univs)),
'Case': Tuple(Constr__case_info(), self.constr, self.constr, Array(self.constr)),
'Fix': Constr__pfixpoint(self.constr, self.types),
'CoFix': Constr__pcofixpoint(self.constr, self.types),
'Proj': Tuple(Names__Projection__t(), self.constr),
})
class Constr__constr(AliasType):
'''
type t = (t, t, Sorts.t, Instance.t) kind_of_term
type constr = t
'''
def __init__(self):
if self.initialized:
return
self.alias = Constr__kind_of_term(Constr__constr(), Constr__constr(), Sorts__t(), Univ__Instance__t())
class Loc__source(Variant):
constructors = OrderedDict({
'InFile': String(),
'ToplevelInput': None,
})
class Loc__t(Record):
'''
type t = {
fname : source; (** filename or toplevel input *)
line_nb : int; (** start line number *)
bol_pos : int; (** position of the beginning of start line *)
line_nb_last : int; (** end line number *)
bol_pos_last : int; (** position of the beginning of end line *)
bp : int; (** start position *)
ep : int; (** end position *)
}
'''
def __init__(self):
self.fields = OrderedDict({
'bp': Int(),
'ep': Int(),
})
class Vernacexpr__vernac_flag(Variant):
def __init__(self):
self.constructors = OrderedDict({
'VernacProgram': None,
'VernacPolymorphic': Bool(),
'VernacLocal': Bool(),
})
class Genarg__rlevel(UnimplementedType):
'''
type rlevel = [ `rlevel ]
'''
pass
class Genarg__glevel(UnimplementedType):
'''
type glevel = [ `glevel ]
'''
pass
class Genarg__tlevel(UnimplementedType):
'''
type tlevel = [ `tlevel ]
'''
pass
class Genarg__ArgT__tag(Type):
'''
type ('a, 'b, 'c) tag = ('a * 'b * 'c) DYN.tag
'''
tags = ['auto_using',
'bindings',
'by_arg_tac',
'casted_constr',
'clause_dft_concl',
'constr',
'constr_with_bindings',
'destruction_arg',
'firstorder_using',
'fun_ind_using',
'glob_constr_with_bindings',
'hintbases',
'ident',
'in_clause',
'int_or_var',
'intropattern',
'ltac_info',
'ltac_selector',
'ltac_use_default',
'natural',
'orient',
'preident',
'quant_hyp',
'rename',
'rewstrategy',
'ssrapplyarg',
'ssrarg',
'ssrcasearg',
'ssrclauses',
'ssrcongrarg',
'ssrdoarg',
'ssrexactarg',
'ssrfwdid',
'ssrhavefwdwbinders',
'ssrhintarg',
'ssrintrosarg',
'ssrmovearg',
'ssrposefwd',
'ssrrpat',
'ssrrwargs',
'ssrseqarg',
'ssrseqdir',
'ssrsetfwd',
'ssrsufffwd',
'ssrtclarg',
'ssrunlockargs',
'tactic',
'uconstr',
'var',
'with_names']
def parsing_rules(self):
'coq-serapi/serlib/ser_genarg.ml'
return ['"%s"' % tag for tag in Genarg__ArgT__tag.tags], []
class Genarg__genarg_type(Variant):
'''
type (_, _, _) genarg_type =
| ExtraArg : ('a, 'b, 'c) ArgT.tag -> ('a, 'b, 'c) genarg_type
| ListArg : ('a, 'b, 'c) genarg_type -> ('a list, 'b list, 'c list) genarg_type
| OptArg : ('a, 'b, 'c) genarg_type -> ('a option, 'b option, 'c option) genarg_type
| PairArg : ('a1, 'b1, 'c1) genarg_type * ('a2, 'b2, 'c2) genarg_type ->
('a1 * 'a2, 'b1 * 'b2, 'c1 * 'c2) genarg_type
'''
def __init__(self):
self.constructors = OrderedDict({
'ExtraArg': Genarg__ArgT__tag(),
'ListArg': self,
'OptArg': self,
'PairArg': Tuple(self, self)
})
class Locus__occurrences_gen(Variant):
'''
type 'a occurrences_gen =
| AllOccurrences
| AllOccurrencesBut of 'a list (** non-empty *)
| NoOccurrences
| OnlyOccurrences of 'a list (** non-empty *)
'''
def __init__(self, a):
assert isinstance(a, Type)
self.a = a
self.constructors = OrderedDict({
'AllOccurrences': None,
'AllOccurrencesBut': List(a),
'NoOccurrences': None,
'OnlyOccurrences': List(a),
})
class Locus__occurrences_expr(AliasType):
'''
type occurrences_expr = (int or_var) occurrences_gen
'''
def __init__(self):
self.alias = Locus__occurrences_gen(Misctypes__or_var(Int()))
class Locus__with_occurrences(AliasType):
'''
type 'a with_occurrences = occurrences_expr * 'a
'''
def __init__(self, a):
assert isinstance(a, Type)
self.a = a
self.alias = Tuple(Locus__occurrences_expr(), a)
class Util__union(Variant):
'''
type ('a, 'b) union = ('a, 'b) CSig.union = Inl of 'a | Inr of 'b
'''
def __init__(self, a, b):
assert isinstance(a, Type) and isinstance(b, Type)
self.a = a
self.b = b
self.constructors = OrderedDict({
'Inl': a,
'Inr': b,
})
class Genredexpr__glob_red_flag(Record):
'''
type 'a glob_red_flag = {
rBeta : bool;
rMatch : bool;
rFix : bool;
rCofix : bool;
rZeta : bool;
rDelta : bool; (** true = delta all but rConst; false = delta only on rConst*)
rConst : 'a list
}
'''
def __init__(self, a):
assert isinstance(a, Type)
self.a = a
self.fields = OrderedDict({
'rBeta' : Bool(),
'rMatch' : Bool(),
'rFix' : Bool(),
'rCofix' : Bool(),
'rZeta' : Bool(),
'rDelta' : Bool(),
'rConst' : List(a),
})
class Genredexpr__red_expr_gen(Variant):
'''
type ('a,'b,'c) red_expr_gen =
| Red of bool
| Hnf
| Simpl of 'b glob_red_flag * ('b,'c) Util.union Locus.with_occurrences option
| Cbv of 'b glob_red_flag
| Cbn of 'b glob_red_flag
| Lazy of 'b glob_red_flag
| Unfold of 'b Locus.with_occurrences list
| Fold of 'a list
| Pattern of 'a Locus.with_occurrences list
| ExtraRedExpr of string
| CbvVm of ('b,'c) Util.union Locus.with_occurrences option
| CbvNative of ('b,'c) Util.union Locus.with_occurrences option
'''
def __init__(self, a, b, c):
assert isinstance(a, Type) and isinstance(b, Type) and isinstance(c, Type)
self.a = a
self.b = b
self.c = c
self.constructors = OrderedDict({
'Simpl': Tuple(Genredexpr__glob_red_flag(b),
Option(Locus__with_occurrences(Util__union(b, c)))),
'Unfold': List(Locus__with_occurrences(b)),
})
class Locus__hyp_location_flag(Variant):
'''
type hyp_location_flag = InHyp | InHypTypeOnly | InHypValueOnly
'''
def __init__(self):
self.constructors = OrderedDict({
'InHyp': None,
'InHypTypeOnly': None,
'InHypValueOnly': None,
})
class Locus__hyp_location_expr(AliasType):
'''
type 'a hyp_location_expr = 'a with_occurrences * hyp_location_flag
'''
def __init__(self, a):
assert isinstance(a, Type)
self.a = a
self.alias = Tuple(Locus__with_occurrences(a), Locus__hyp_location_flag())
class Locus__clause_expr(Record):
'''
type 'id clause_expr =
{ onhyps : 'id hyp_location_expr list option;
concl_occs : occurrences_expr }
'''
def __init__(self, id):
assert isinstance(id, Type)
self.id = id
self.fields = OrderedDict({
'onhyps': Option(List(Locus__hyp_location_expr(id))),
'concl_occs': Locus__occurrences_expr(),
})
# (** Possible arguments of a tactic definition *)
class Tacexpr__gen_tactic_arg(Variant):
'''
type 'a gen_tactic_arg =
| TacGeneric of 'lev generic_argument
| ConstrMayEval of ('trm,'cst,'pat) may_eval
| Reference of 'ref
| TacCall of ('ref * 'a gen_tactic_arg list) Loc.located
| TacFreshId of string or_var list
| Tacexp of 'tacexpr
| TacPretype of 'trm
| TacNumgoals
constraint 'a = <
term:'trm;
dterm: 'dtrm;
pattern:'pat;
constant:'cst;
reference:'ref;
name:'nam;
tacexpr:'tacexpr;
level:'lev
>
'''
def __init__(self, a):
assert isinstance(a, Type)
self.a = a
self.constructors = OrderedDict({
'TacGeneric': Genarg__generic_argument(a.members['level']),
'TacCall': Loc__located(Tuple(a.members['reference'], List(self))),
})
class Tacexpr__advanced_flag(AliasType):
'''
type advanced_flag = bool (* true = advanced false = basic *)
'''
def __init__(self):
self.alias = Bool()
class Tacexpr__evars_flag(AliasType):
'''
type evars_flag = bool (* true = pose evars false = fail on evars *)
'''
def __init__(self):
self.alias = Bool()
class Tacexpr__clear_flag(AliasType):
'''
type clear_flag = bool option (* true = clear hyp, false = keep hyp, None = use default *)
'''
def __init__(self):
self.alias = Option(Bool())
class Tacexpr__with_bindings_arg(AliasType):
'''
type 'a with_bindings_arg = clear_flag * 'a with_bindings
'''
def __init__(self, a):
assert isinstance(a, Type)
self.a = a
self.alias = Tuple(Tacexpr__clear_flag(), Tactypes__with_bindings(a))
class Tacexpr__gen_atomic_tactic_expr(Variant):
'''
type 'a gen_atomic_tactic_expr =
(* Basic tactics *)
| TacIntroPattern of evars_flag * 'dtrm intro_pattern_expr CAst.t list
| TacApply of advanced_flag * evars_flag * 'trm with_bindings_arg list *
('nam * 'dtrm intro_pattern_expr CAst.t option) option
| TacElim of evars_flag * 'trm with_bindings_arg * 'trm with_bindings option
| TacCase of evars_flag * 'trm with_bindings_arg
| TacMutualFix of Id.t * int * (Id.t * int * 'trm) list
| TacMutualCofix of Id.t * (Id.t * 'trm) list
| TacAssert of
evars_flag * bool * 'tacexpr option option *
'dtrm intro_pattern_expr CAst.t option * 'trm
| TacGeneralize of ('trm with_occurrences * Name.t) list
| TacLetTac of evars_flag * Name.t * 'trm * 'nam clause_expr * letin_flag *
intro_pattern_naming_expr CAst.t option
(* Derived basic tactics *)
| TacInductionDestruct of
rec_flag * evars_flag * ('trm,'dtrm,'nam) induction_clause_list
(* Conversion *)
| TacReduce of ('trm,'cst,'pat) red_expr_gen * 'nam clause_expr
| TacChange of 'pat option * 'dtrm * 'nam clause_expr
(* Equality and inversion *)
| TacRewrite of evars_flag *
(bool * multi * 'dtrm with_bindings_arg) list * 'nam clause_expr *
(* spiwack: using ['dtrm] here is a small hack, may not be
stable by a change in the representation of delayed
terms. Because, in fact, it is the whole "with_bindings"
which is delayed. But because the "t" level for ['dtrm] is
uninterpreted, it works fine here too, and avoid more
disruption of this file. *)
'tacexpr option
| TacInversion of ('trm,'dtrm,'nam) inversion_strength * quantified_hypothesis
constraint 'a = <
term:'trm;
dterm: 'dtrm;
pattern:'pat;
constant:'cst;
reference:'ref;
name:'nam;
tacexpr:'tacexpr;
level:'lev
>
'''
def __init__(self, a):
assert isinstance(a, Type)
self.a = a
self.constructors = OrderedDict({
'TacIntroPattern': Tuple(Tacexpr__evars_flag(), List(CAst__t(Tactypes__intro_pattern_expr(a.members['dterm'])))),
'TacApply': Tuple(Tacexpr__advanced_flag(), Tacexpr__evars_flag(),
List(Tacexpr__with_bindings_arg(a.members['term'])),
Option(Tuple(a.members['name'], Option(CAst__t(Tactypes__intro_pattern_expr(a.members['dterm'])))))),
'TacCase': Tuple(Tacexpr__evars_flag(), Tacexpr__with_bindings_arg(a.members['term'])),
'TacReduce': Tuple(Genredexpr__red_expr_gen(a.members['term'], a.members['constant'], a.members['pattern']),
Locus__clause_expr(a.members['name'])),
})
class Tacexpr__gen_tactic_expr(Variant):
'''
and 'a gen_tactic_expr =
| TacAtom of ('a gen_atomic_tactic_expr) Loc.located
| TacThen of
'a gen_tactic_expr *
'a gen_tactic_expr
| TacDispatch of
'a gen_tactic_expr list
| TacExtendTac of
'a gen_tactic_expr array *
'a gen_tactic_expr *
'a gen_tactic_expr array
| TacThens of
'a gen_tactic_expr *
'a gen_tactic_expr list
| TacThens3parts of
'a gen_tactic_expr *
'a gen_tactic_expr array *
'a gen_tactic_expr *
'a gen_tactic_expr array
| TacFirst of 'a gen_tactic_expr list
| TacComplete of 'a gen_tactic_expr
| TacSolve of 'a gen_tactic_expr list
| TacTry of 'a gen_tactic_expr
| TacOr of
'a gen_tactic_expr *
'a gen_tactic_expr
| TacOnce of
'a gen_tactic_expr
| TacExactlyOnce of
'a gen_tactic_expr
| TacIfThenCatch of
'a gen_tactic_expr *
'a gen_tactic_expr *
'a gen_tactic_expr
| TacOrelse of
'a gen_tactic_expr *
'a gen_tactic_expr
| TacDo of int or_var * 'a gen_tactic_expr
| TacTimeout of int or_var * 'a gen_tactic_expr
| TacTime of string option * 'a gen_tactic_expr
| TacRepeat of 'a gen_tactic_expr
| TacProgress of 'a gen_tactic_expr
| TacShowHyps of 'a gen_tactic_expr
| TacAbstract of
'a gen_tactic_expr * Id.t option
| TacId of 'n message_token list
| TacFail of global_flag * int or_var * 'n message_token list
| TacInfo of 'a gen_tactic_expr
| TacLetIn of rec_flag *
(lname * 'a gen_tactic_arg) list *
'a gen_tactic_expr
| TacMatch of lazy_flag *
'a gen_tactic_expr *
('p,'a gen_tactic_expr) match_rule list
| TacMatchGoal of lazy_flag * direction_flag *
('p,'a gen_tactic_expr) match_rule list
| TacFun of 'a gen_tactic_fun_ast
| TacArg of 'a gen_tactic_arg located
| TacSelect of goal_selector * 'a gen_tactic_expr
(* For ML extensions *)
| TacML of (ml_tactic_entry * 'a gen_tactic_arg list) Loc.located
(* For syntax extensions *)
| TacAlias of (KerName.t * 'a gen_tactic_arg list) Loc.located
constraint 'a = <
term:'t;
dterm: 'dtrm;
pattern:'p;
constant:'c;
reference:'r;
name:'n;
tacexpr:'tacexpr;
level:'l
>
'''
def __init__(self, a):
assert isinstance(a, Type)
self.a = a
self.constructors = OrderedDict({
'TacAtom': Loc__located(Tacexpr__gen_atomic_tactic_expr(a)),
'TacThen': Tuple(self, self),
'TacTry': self,
'TacAlias': Loc__located(Tuple(Names__KerName__t(), List(Tacexpr__gen_tactic_arg(a)))),
'TacArg': Loc__located(Tacexpr__gen_tactic_arg(a)),
})
class Evar_kinds__t(Variant):
'''
type t =
| ImplicitArg of global_reference * (int * Id.t option)
* bool (** Force inference *)
| BinderType of Name.t
| NamedHole of Id.t (* coming from some ?[id] syntax *)
| QuestionMark of obligation_definition_status * Name.t
| CasesType of bool (* true = a subterm of the type *)
| InternalHole
| TomatchTypeParameter of inductive * int
| GoalEvar
| ImpossibleCase
| MatchingVar of matching_var_kind
| VarInstance of Id.t
| SubEvar of Evar.t
'''
def __init__(self):
self.constructors = OrderedDict({