-
Notifications
You must be signed in to change notification settings - Fork 2
/
typinf.ml
2926 lines (2296 loc) · 79.1 KB
/
typinf.ml
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
type __ = Obj.t
let __ = let rec f _ = Obj.repr f in Obj.repr f
type bool =
| True
| False
type nat =
| O
| S of nat
type 'a option =
| Some of 'a
| None
type ('a, 'b) sum =
| Inl of 'a
| Inr of 'b
type ('a, 'b) prod =
| Pair of 'a * 'b
(** val fst : ('a1, 'a2) prod -> 'a1 **)
let fst = function
| Pair (x, _) -> x
(** val snd : ('a1, 'a2) prod -> 'a2 **)
let snd = function
| Pair (_, y) -> y
type 'a list =
| Nil
| Cons of 'a * 'a list
(** val length : 'a1 list -> nat **)
let rec length = function
| Nil -> O
| Cons (_, l') -> S (length l')
(** val app : 'a1 list -> 'a1 list -> 'a1 list **)
let rec app l m =
match l with
| Nil -> m
| Cons (a, l1) -> Cons (a, (app l1 m))
type comparison =
| Eq
| Lt
| Gt
(** val compOpp : comparison -> comparison **)
let compOpp = function
| Eq -> Eq
| Lt -> Gt
| Gt -> Lt
type 'a sig0 = 'a
(* singleton inductive, whose constructor was exist *)
type sumbool =
| Left
| Right
type 'a sumor =
| Inleft of 'a
| Inright
(** val add : nat -> nat -> nat **)
let rec add n m =
match n with
| O -> m
| S p -> S (add p m)
(** val sub : nat -> nat -> nat **)
let rec sub n m =
match n with
| O -> n
| S k -> (match m with
| O -> n
| S l -> sub k l)
module type EqLtLe =
sig
type t
end
module MakeOrderTac =
functor (O:EqLtLe) ->
functor (P:sig
end) ->
struct
end
module Nat =
struct
(** val max : nat -> nat -> nat **)
let rec max n m =
match n with
| O -> m
| S n' -> (match m with
| O -> n
| S m' -> S (max n' m'))
(** val eq_dec : nat -> nat -> sumbool **)
let rec eq_dec n m =
match n with
| O -> (match m with
| O -> Left
| S _ -> Right)
| S n0 -> (match m with
| O -> Right
| S n1 -> eq_dec n0 n1)
end
(** val nth : nat -> 'a1 list -> 'a1 -> 'a1 **)
let rec nth n l default =
match n with
| O -> (match l with
| Nil -> default
| Cons (x, _) -> x)
| S m -> (match l with
| Nil -> default
| Cons (_, t0) -> nth m t0 default)
(** val map : ('a1 -> 'a2) -> 'a1 list -> 'a2 list **)
let rec map f = function
| Nil -> Nil
| Cons (a, t0) -> Cons ((f a), (map f t0))
(** val fold_left : ('a1 -> 'a2 -> 'a1) -> 'a2 list -> 'a1 -> 'a1 **)
let rec fold_left f l a0 =
match l with
| Nil -> a0
| Cons (b, t0) -> fold_left f t0 (f a0 b)
(** val fold_right : ('a2 -> 'a1 -> 'a1) -> 'a1 -> 'a2 list -> 'a1 **)
let rec fold_right f a0 = function
| Nil -> a0
| Cons (b, t0) -> f b (fold_right f a0 t0)
(** val split : ('a1, 'a2) prod list -> ('a1 list, 'a2 list) prod **)
let rec split = function
| Nil -> Pair (Nil, Nil)
| Cons (p, tl) ->
let Pair (x, y) = p in
let Pair (left, right) = split tl in
Pair ((Cons (x, left)), (Cons (y, right)))
(** val combine : 'a1 list -> 'a2 list -> ('a1, 'a2) prod list **)
let rec combine l l' =
match l with
| Nil -> Nil
| Cons (x, tl) ->
(match l' with
| Nil -> Nil
| Cons (y, tl') -> Cons ((Pair (x, y)), (combine tl tl')))
(** val seq : nat -> nat -> nat list **)
let rec seq start = function
| O -> Nil
| S len0 -> Cons (start, (seq (S start) len0))
(** val le_lt_dec : nat -> nat -> sumbool **)
let rec le_lt_dec n m =
match n with
| O -> Left
| S n0 -> (match m with
| O -> Right
| S n1 -> le_lt_dec n0 n1)
type positive =
| XI of positive
| XO of positive
| XH
type z =
| Z0
| Zpos of positive
| Zneg of positive
module Pos =
struct
(** val succ : positive -> positive **)
let rec succ = function
| XI p -> XO (succ p)
| XO p -> XI p
| XH -> XO XH
(** val add : positive -> positive -> positive **)
let rec add x y =
match x with
| XI p ->
(match y with
| XI q -> XO (add_carry p q)
| XO q -> XI (add p q)
| XH -> XO (succ p))
| XO p ->
(match y with
| XI q -> XI (add p q)
| XO q -> XO (add p q)
| XH -> XI p)
| XH -> (match y with
| XI q -> XO (succ q)
| XO q -> XI q
| XH -> XO XH)
(** val add_carry : positive -> positive -> positive **)
and add_carry x y =
match x with
| XI p ->
(match y with
| XI q -> XI (add_carry p q)
| XO q -> XO (add_carry p q)
| XH -> XI (succ p))
| XO p ->
(match y with
| XI q -> XO (add_carry p q)
| XO q -> XI (add p q)
| XH -> XO (succ p))
| XH ->
(match y with
| XI q -> XI (succ q)
| XO q -> XO (succ q)
| XH -> XI XH)
(** val pred_double : positive -> positive **)
let rec pred_double = function
| XI p -> XI (XO p)
| XO p -> XI (pred_double p)
| XH -> XH
(** val compare_cont : comparison -> positive -> positive -> comparison **)
let rec compare_cont r x y =
match x with
| XI p ->
(match y with
| XI q -> compare_cont r p q
| XO q -> compare_cont Gt p q
| XH -> Gt)
| XO p ->
(match y with
| XI q -> compare_cont Lt p q
| XO q -> compare_cont r p q
| XH -> Gt)
| XH -> (match y with
| XH -> r
| _ -> Lt)
(** val compare : positive -> positive -> comparison **)
let compare =
compare_cont Eq
(** val eq_dec : positive -> positive -> sumbool **)
let rec eq_dec p x0 =
match p with
| XI p0 -> (match x0 with
| XI p1 -> eq_dec p0 p1
| _ -> Right)
| XO p0 -> (match x0 with
| XO p1 -> eq_dec p0 p1
| _ -> Right)
| XH -> (match x0 with
| XH -> Left
| _ -> Right)
end
module Z =
struct
(** val double : z -> z **)
let double = function
| Z0 -> Z0
| Zpos p -> Zpos (XO p)
| Zneg p -> Zneg (XO p)
(** val succ_double : z -> z **)
let succ_double = function
| Z0 -> Zpos XH
| Zpos p -> Zpos (XI p)
| Zneg p -> Zneg (Pos.pred_double p)
(** val pred_double : z -> z **)
let pred_double = function
| Z0 -> Zneg XH
| Zpos p -> Zpos (Pos.pred_double p)
| Zneg p -> Zneg (XI p)
(** val pos_sub : positive -> positive -> z **)
let rec pos_sub x y =
match x with
| XI p ->
(match y with
| XI q -> double (pos_sub p q)
| XO q -> succ_double (pos_sub p q)
| XH -> Zpos (XO p))
| XO p ->
(match y with
| XI q -> pred_double (pos_sub p q)
| XO q -> double (pos_sub p q)
| XH -> Zpos (Pos.pred_double p))
| XH ->
(match y with
| XI q -> Zneg (XO q)
| XO q -> Zneg (Pos.pred_double q)
| XH -> Z0)
(** val add : z -> z -> z **)
let add x y =
match x with
| Z0 -> y
| Zpos x' ->
(match y with
| Z0 -> x
| Zpos y' -> Zpos (Pos.add x' y')
| Zneg y' -> pos_sub x' y')
| Zneg x' ->
(match y with
| Z0 -> x
| Zpos y' -> pos_sub y' x'
| Zneg y' -> Zneg (Pos.add x' y'))
(** val compare : z -> z -> comparison **)
let compare x y =
match x with
| Z0 -> (match y with
| Z0 -> Eq
| Zpos _ -> Lt
| Zneg _ -> Gt)
| Zpos x' -> (match y with
| Zpos y' -> Pos.compare x' y'
| _ -> Gt)
| Zneg x' ->
(match y with
| Zneg y' -> compOpp (Pos.compare x' y')
| _ -> Lt)
(** val max : z -> z -> z **)
let max n m =
match compare n m with
| Lt -> m
| _ -> n
(** val eq_dec : z -> z -> sumbool **)
let eq_dec x y =
match x with
| Z0 -> (match y with
| Z0 -> Left
| _ -> Right)
| Zpos p -> (match y with
| Zpos p0 -> Pos.eq_dec p p0
| _ -> Right)
| Zneg p -> (match y with
| Zneg p0 -> Pos.eq_dec p p0
| _ -> Right)
end
type 'x compare0 =
| LT
| EQ
| GT
module type OrderedType =
sig
type t
val compare : t -> t -> t compare0
val eq_dec : t -> t -> sumbool
end
module OrderedTypeFacts =
functor (O:OrderedType) ->
struct
module TO =
struct
type t = O.t
end
module IsTO =
struct
end
module OrderTac = MakeOrderTac(TO)(IsTO)
(** val eq_dec : O.t -> O.t -> sumbool **)
let eq_dec =
O.eq_dec
(** val lt_dec : O.t -> O.t -> sumbool **)
let lt_dec x y =
match O.compare x y with
| LT -> Left
| _ -> Right
(** val eqb : O.t -> O.t -> bool **)
let eqb x y =
match eq_dec x y with
| Left -> True
| Right -> False
end
module type UsualOrderedType =
sig
type t
val compare : t -> t -> t compare0
val eq_dec : t -> t -> sumbool
end
module Z_as_OT =
struct
type t = z
(** val compare : z -> z -> z compare0 **)
let compare x y =
match Z.compare x y with
| Eq -> EQ
| Lt -> LT
| Gt -> GT
(** val eq_dec : z -> z -> sumbool **)
let eq_dec =
Z.eq_dec
end
module type S =
sig
module E :
OrderedType
type elt = E.t
type t
val empty : t
val is_empty : t -> bool
val mem : elt -> t -> bool
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val diff : t -> t -> t
val compare : t -> t -> t compare0
val equal : t -> t -> bool
val subset : t -> t -> bool
val fold : (elt -> 'a1 -> 'a1) -> t -> 'a1 -> 'a1
val for_all : (elt -> bool) -> t -> bool
val exists_ : (elt -> bool) -> t -> bool
val filter : (elt -> bool) -> t -> t
val partition : (elt -> bool) -> t -> (t, t) prod
val cardinal : t -> nat
val elements : t -> elt list
val min_elt : t -> elt option
val max_elt : t -> elt option
val choose : t -> elt option
end
module type FinSet =
sig
module E :
UsualOrderedType
module S :
S with module E = E
type fset = S.t
type elt = S.elt
end
module Raw =
functor (X:OrderedType) ->
struct
module MX = OrderedTypeFacts(X)
type elt = X.t
type t = elt list
(** val empty : t **)
let empty =
Nil
(** val is_empty : t -> bool **)
let is_empty = function
| Nil -> True
| Cons (_, _) -> False
(** val mem : elt -> t -> bool **)
let rec mem x = function
| Nil -> False
| Cons (y, l) ->
(match X.compare x y with
| LT -> False
| EQ -> True
| GT -> mem x l)
(** val add : elt -> t -> t **)
let rec add x s = match s with
| Nil -> Cons (x, Nil)
| Cons (y, l) ->
(match X.compare x y with
| LT -> Cons (x, s)
| EQ -> s
| GT -> Cons (y, (add x l)))
(** val singleton : elt -> t **)
let singleton x =
Cons (x, Nil)
(** val remove : elt -> t -> t **)
let rec remove x s = match s with
| Nil -> Nil
| Cons (y, l) ->
(match X.compare x y with
| LT -> s
| EQ -> l
| GT -> Cons (y, (remove x l)))
(** val union : t -> t -> t **)
let rec union s = match s with
| Nil -> (fun s' -> s')
| Cons (x, l) ->
let rec union_aux s' = match s' with
| Nil -> s
| Cons (x', l') ->
(match X.compare x x' with
| LT -> Cons (x, (union l s'))
| EQ -> Cons (x, (union l l'))
| GT -> Cons (x', (union_aux l')))
in union_aux
(** val inter : t -> t -> t **)
let rec inter = function
| Nil -> (fun _ -> Nil)
| Cons (x, l) ->
let rec inter_aux s' = match s' with
| Nil -> Nil
| Cons (x', l') ->
(match X.compare x x' with
| LT -> inter l s'
| EQ -> Cons (x, (inter l l'))
| GT -> inter_aux l')
in inter_aux
(** val diff : t -> t -> t **)
let rec diff s = match s with
| Nil -> (fun _ -> Nil)
| Cons (x, l) ->
let rec diff_aux s' = match s' with
| Nil -> s
| Cons (x', l') ->
(match X.compare x x' with
| LT -> Cons (x, (diff l s'))
| EQ -> diff l l'
| GT -> diff_aux l')
in diff_aux
(** val equal : t -> t -> bool **)
let rec equal s s' =
match s with
| Nil -> (match s' with
| Nil -> True
| Cons (_, _) -> False)
| Cons (x, l) ->
(match s' with
| Nil -> False
| Cons (x', l') ->
(match X.compare x x' with
| EQ -> equal l l'
| _ -> False))
(** val subset : t -> t -> bool **)
let rec subset s s' =
match s with
| Nil -> True
| Cons (x, l) ->
(match s' with
| Nil -> False
| Cons (x', l') ->
(match X.compare x x' with
| LT -> False
| EQ -> subset l l'
| GT -> subset s l'))
(** val fold : (elt -> 'a1 -> 'a1) -> t -> 'a1 -> 'a1 **)
let rec fold f s i =
match s with
| Nil -> i
| Cons (x, l) -> fold f l (f x i)
(** val filter : (elt -> bool) -> t -> t **)
let rec filter f = function
| Nil -> Nil
| Cons (x, l) ->
(match f x with
| True -> Cons (x, (filter f l))
| False -> filter f l)
(** val for_all : (elt -> bool) -> t -> bool **)
let rec for_all f = function
| Nil -> True
| Cons (x, l) -> (match f x with
| True -> for_all f l
| False -> False)
(** val exists_ : (elt -> bool) -> t -> bool **)
let rec exists_ f = function
| Nil -> False
| Cons (x, l) -> (match f x with
| True -> True
| False -> exists_ f l)
(** val partition : (elt -> bool) -> t -> (t, t) prod **)
let rec partition f = function
| Nil -> Pair (Nil, Nil)
| Cons (x, l) ->
let Pair (s1, s2) = partition f l in
(match f x with
| True -> Pair ((Cons (x, s1)), s2)
| False -> Pair (s1, (Cons (x, s2))))
(** val cardinal : t -> nat **)
let cardinal =
length
(** val elements : t -> elt list **)
let elements x =
x
(** val min_elt : t -> elt option **)
let min_elt = function
| Nil -> None
| Cons (x, _) -> Some x
(** val max_elt : t -> elt option **)
let rec max_elt = function
| Nil -> None
| Cons (x, l) -> (match l with
| Nil -> Some x
| Cons (_, _) -> max_elt l)
(** val choose : t -> elt option **)
let choose =
min_elt
(** val compare : t -> t -> t compare0 **)
let rec compare l s' =
match l with
| Nil -> (match s' with
| Nil -> EQ
| Cons (_, _) -> LT)
| Cons (y, l0) ->
(match s' with
| Nil -> GT
| Cons (a, l1) ->
(match X.compare y a with
| LT -> LT
| EQ -> (match compare l0 l1 with
| LT -> LT
| EQ -> EQ
| GT -> GT)
| GT -> GT))
end
module MakeRaw =
functor (X:UsualOrderedType) ->
struct
module Raw = Raw(X)
module E = X
module OTFacts = OrderedTypeFacts(E)
type slist =
Raw.t
(* singleton inductive, whose constructor was Build_slist *)
(** val this : slist -> Raw.t **)
let this s =
s
(** val coq_Build_slist' : Raw.t -> slist **)
let coq_Build_slist' xs =
xs
type t = slist
type elt = E.t
(** val mem : elt -> t -> bool **)
let mem x s =
Raw.mem x (this s)
(** val add : elt -> t -> t **)
let add x s =
coq_Build_slist' (Raw.add x (this s))
(** val remove : elt -> t -> t **)
let remove x s =
coq_Build_slist' (Raw.remove x (this s))
(** val singleton : elt -> t **)
let singleton x =
coq_Build_slist' (Raw.singleton x)
(** val union : t -> t -> t **)
let union s s' =
coq_Build_slist' (Raw.union (this s) (this s'))
(** val inter : t -> t -> t **)
let inter s s' =
coq_Build_slist' (Raw.inter (this s) (this s'))
(** val diff : t -> t -> t **)
let diff s s' =
coq_Build_slist' (Raw.diff (this s) (this s'))
(** val equal : t -> t -> bool **)
let equal s s' =
Raw.equal (this s) (this s')
(** val subset : t -> t -> bool **)
let subset s s' =
Raw.subset (this s) (this s')
(** val empty : t **)
let empty =
coq_Build_slist' Raw.empty
(** val is_empty : t -> bool **)
let is_empty s =
Raw.is_empty (this s)
(** val elements : t -> elt list **)
let elements s =
Raw.elements (this s)
(** val min_elt : t -> elt option **)
let min_elt s =
Raw.min_elt (this s)
(** val max_elt : t -> elt option **)
let max_elt s =
Raw.max_elt (this s)
(** val choose : t -> elt option **)
let choose s =
Raw.choose (this s)
(** val fold : (elt -> 'a1 -> 'a1) -> t -> 'a1 -> 'a1 **)
let fold f s =
Raw.fold f (this s)
(** val cardinal : t -> nat **)
let cardinal s =
Raw.cardinal (this s)
(** val filter : (elt -> bool) -> t -> t **)
let filter f s =
coq_Build_slist' (Raw.filter f (this s))
(** val for_all : (elt -> bool) -> t -> bool **)
let for_all f s =
Raw.for_all f (this s)
(** val exists_ : (elt -> bool) -> t -> bool **)
let exists_ f s =
Raw.exists_ f (this s)
(** val partition : (elt -> bool) -> t -> (t, t) prod **)
let partition f s =
let p = Raw.partition f (this s) in
Pair ((coq_Build_slist' (fst p)), (coq_Build_slist' (snd p)))
(** val compare : t -> t -> t compare0 **)
let compare s s' =
match Raw.compare (this s) (this s') with
| LT -> LT
| EQ -> EQ
| GT -> GT
(** val eq_dec : t -> t -> sumbool **)
let eq_dec s s' =
match equal s s' with
| True -> Left
| False -> Right
end
module Make =
functor (X:UsualOrderedType) ->
struct
module E = X
module S = MakeRaw(X)
type fset = S.t
type elt = S.elt
end
module type VARIABLES =
sig
type var
val var_default : var
module Var_as_OT :
UsualOrderedType with type t = var
module VarSet :
FinSet with module E = Var_as_OT
type vars = VarSet.S.t
val var_generate : vars -> var
val var_fresh : vars -> var
val var_of_Z : z -> var
val coq_Z_of_var : var -> z
end
module Variables =
struct
type var = z
(** val var_default : var **)
let var_default =
Z0
(** val var_of_Z : var -> var **)
let var_of_Z x =
x
(** val coq_Z_of_var : z -> z **)
let coq_Z_of_var x =
x
module Var_as_OT = Z_as_OT
module VarSet = Make(Var_as_OT)
type vars = VarSet.S.t
(** val finite_nat_list_max : z list -> z **)
let rec finite_nat_list_max = function
| Nil -> Z0
| Cons (y, l0) -> Z.max (finite_nat_list_max l0) y
(** val finite_nat_list_max' : z list -> z **)
let finite_nat_list_max' l =
Z.add (finite_nat_list_max l) (Zpos XH)
(** val var_generate : vars -> var **)
let var_generate l =
finite_nat_list_max' (VarSet.S.elements l)
(** val var_generate_spec : __ **)
let var_generate_spec =
__
(** val var_fresh : vars -> var **)
let var_fresh =
var_generate
end
module Var_as_OT_Facts = OrderedTypeFacts(Variables.Var_as_OT)
(** val eq_var_dec : Variables.var -> Variables.var -> sumbool **)
let eq_var_dec =
Var_as_OT_Facts.eq_dec
(** val var_freshes : Variables.vars -> nat -> Variables.var list **)
let rec var_freshes l = function
| O -> Nil
| S n0 ->
let s = Variables.var_fresh l in
let s0 =
var_freshes (Variables.VarSet.S.union l (Variables.VarSet.S.singleton s))
n0
in