aboutsummaryrefslogtreecommitdiff
path: root/proofs/proofview_gen.ml
blob: 42209587006093c1c2150d676bd9749332624137 (plain)
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
(* This file has been generated by extraction
   of bootstrap/Monad.v. It shouldn't be
   modified directly. To regenerate it run
   coqtop -batch -impredicative-set
   bootstrap/Monad.v in Coq's source
   directory. *)

type __ = Obj.t
let __ = let rec f _ = Obj.repr f in Obj.repr f

module IOBase = 
 struct 
  type 'a coq_T = unit -> 'a
  
  type 'a coq_Ref = 'a Pervasives.ref
  
  (** val ret : 'a1 -> 'a1 coq_T **)
  
  let ret = fun a () -> a
  
  (** val bind :
      'a1 coq_T -> ('a1 -> 'a2 coq_T) -> 'a2
      coq_T **)
  
  let bind = fun a k () -> k (a ()) ()
  
  (** val ignore :
      'a1 coq_T -> unit coq_T **)
  
  let ignore = fun a () -> ignore (a ())
  
  (** val seq :
      unit coq_T -> 'a1 coq_T -> 'a1 coq_T **)
  
  let seq = fun a k () -> a (); k ()
  
  (** val ref : 'a1 -> 'a1 coq_Ref coq_T **)
  
  let ref = fun a () -> Pervasives.ref a
  
  (** val set :
      'a1 coq_Ref -> 'a1 -> unit coq_T **)
  
  let set = fun r a () -> Pervasives.(:=) r a
  
  (** val get : 'a1 coq_Ref -> 'a1 coq_T **)
  
  let get = fun r () -> Pervasives.(!) r
  
  (** val raise : exn -> 'a1 coq_T **)
  
  let raise = fun e () -> raise (Proof_errors.Exception e)
  
  (** val catch :
      'a1 coq_T -> (exn -> 'a1 coq_T) -> 'a1
      coq_T **)
  
  let catch = fun s h () -> try s () with Proof_errors.Exception e -> h e ()
  
  (** val read_line : string coq_T **)
  
  let read_line = fun () -> try Pervasives.read_line () with e -> raise e ()
  
  (** val print_char : char -> unit coq_T **)
  
  let print_char = fun c () -> print_char c
  
  (** val print :
      Pp.std_ppcmds -> unit coq_T **)
  
  let print = fun s () -> try Pp.pp s; Pp.pp_flush () with e -> raise e ()
  
  (** val timeout :
      int -> 'a1 coq_T -> 'a1 coq_T **)
  
  let timeout = fun n t () ->
    let timeout_handler _ = Pervasives.raise (Proof_errors.Exception Proof_errors.Timeout) in
    let psh = Sys.signal Sys.sigalrm (Sys.Signal_handle timeout_handler) in
    Pervasives.ignore (Unix.alarm n);
    let restore_timeout () =
      Pervasives.ignore (Unix.alarm 0);
      Sys.set_signal Sys.sigalrm psh
    in
    try
      let res = t () in
      restore_timeout ();
      res
    with
    | e -> restore_timeout (); Pervasives.raise e
 
 end

type proofview = { initial : (Term.constr*Term.types)
                             list;
                   solution : Evd.evar_map;
                   comb : Goal.goal list }

type logicalState = proofview

type logicalMessageType = bool

type logicalEnvironment = Environ.env

module NonLogical = 
 struct 
  type 'a t = 'a IOBase.coq_T
  
  type 'a ref = 'a IOBase.coq_Ref
  
  (** val ret : 'a1 -> 'a1 t **)
  
  let ret x =
    IOBase.ret x
  
  (** val bind :
      'a1 t -> ('a1 -> 'a2 t) -> 'a2 t **)
  
  let bind x k =
    IOBase.bind x k
  
  (** val ignore : 'a1 t -> unit t **)
  
  let ignore x =
    IOBase.ignore x
  
  (** val seq : unit t -> 'a1 t -> 'a1 t **)
  
  let seq x k =
    IOBase.seq x k
  
  (** val new_ref : 'a1 -> 'a1 ref t **)
  
  let new_ref x =
    IOBase.ref x
  
  (** val set : 'a1 ref -> 'a1 -> unit t **)
  
  let set r x =
    IOBase.set r x
  
  (** val get : 'a1 ref -> 'a1 t **)
  
  let get r =
    IOBase.get r
  
  (** val raise : exn -> 'a1 t **)
  
  let raise e =
    IOBase.raise e
  
  (** val catch :
      'a1 t -> (exn -> 'a1 t) -> 'a1 t **)
  
  let catch s h =
    IOBase.catch s h
  
  (** val timeout : int -> 'a1 t -> 'a1 t **)
  
  let timeout n x =
    IOBase.timeout n x
  
  (** val read_line : string t **)
  
  let read_line =
    IOBase.read_line
  
  (** val print_char : char -> unit t **)
  
  let print_char c =
    IOBase.print_char c
  
  (** val print : Pp.std_ppcmds -> unit t **)
  
  let print s =
    IOBase.print s
  
  (** val run : 'a1 t -> 'a1 **)
  
  let run = fun x -> try x () with Proof_errors.Exception e -> Pervasives.raise e
 end

module Logical = 
 struct 
  type 'a t =
    proofview -> Environ.env -> __ ->
    ((('a*proofview)*bool) -> (exn -> __
    IOBase.coq_T) -> __ IOBase.coq_T) -> (exn
    -> __ IOBase.coq_T) -> __ IOBase.coq_T
  
  (** val ret :
      'a1 -> proofview -> Environ.env -> __
      -> ((('a1*proofview)*bool) -> (exn ->
      'a2 IOBase.coq_T) -> 'a2 IOBase.coq_T)
      -> (exn -> 'a2 IOBase.coq_T) -> 'a2
      IOBase.coq_T **)
  
  let ret x s e r sk fk =
    sk ((x,s),true) fk
  
  (** val bind :
      'a1 t -> ('a1 -> 'a2 t) -> proofview ->
      Environ.env -> __ ->
      ((('a2*proofview)*bool) -> (exn -> 'a3
      IOBase.coq_T) -> 'a3 IOBase.coq_T) ->
      (exn -> 'a3 IOBase.coq_T) -> 'a3
      IOBase.coq_T **)
  
  let bind x k s e r sk fk =
    Obj.magic x s e __ (fun a fk0 ->
      let x0,c = a in
      let x1,s0 = x0 in
      Obj.magic k x1 s0 e __ (fun a0 fk1 ->
        let y,c' = a0 in
        sk (y,(if c then c' else false)) fk1)
        fk0) fk
  
  (** val ignore :
      'a1 t -> proofview -> Environ.env -> __
      -> (((unit*proofview)*bool) -> (exn ->
      'a2 IOBase.coq_T) -> 'a2 IOBase.coq_T)
      -> (exn -> 'a2 IOBase.coq_T) -> 'a2
      IOBase.coq_T **)
  
  let ignore x s e r sk fk =
    Obj.magic x s e __ (fun a fk0 ->
      let x0,c = a in
      let sk0 = fun a0 fk1 ->
        let y,c' = a0 in
        sk (y,(if c then c' else false)) fk1
      in
      let a0,s0 = x0 in
      sk0 (((),s0),true) fk0) fk
  
  (** val seq :
      unit t -> 'a1 t -> proofview ->
      Environ.env -> __ ->
      ((('a1*proofview)*bool) -> (exn -> 'a2
      IOBase.coq_T) -> 'a2 IOBase.coq_T) ->
      (exn -> 'a2 IOBase.coq_T) -> 'a2
      IOBase.coq_T **)
  
  let seq x k s e r sk fk =
    Obj.magic x s e __ (fun a fk0 ->
      let x0,c = a in
      let u,s0 = x0 in
      Obj.magic k s0 e __ (fun a0 fk1 ->
        let y,c' = a0 in
        sk (y,(if c then c' else false)) fk1)
        fk0) fk
  
  (** val set :
      logicalState -> proofview ->
      Environ.env -> __ ->
      (((unit*proofview)*bool) -> (exn -> 'a1
      IOBase.coq_T) -> 'a1 IOBase.coq_T) ->
      (exn -> 'a1 IOBase.coq_T) -> 'a1
      IOBase.coq_T **)
  
  let set s s0 e r sk fk =
    sk (((),s),true) fk
  
  (** val get :
      proofview -> Environ.env -> __ ->
      (((logicalState*proofview)*bool) ->
      (exn -> 'a1 IOBase.coq_T) -> 'a1
      IOBase.coq_T) -> (exn -> 'a1
      IOBase.coq_T) -> 'a1 IOBase.coq_T **)
  
  let get s e r sk fk =
    sk ((s,s),true) fk
  
  (** val put :
      logicalMessageType -> proofview ->
      Environ.env -> __ ->
      (((unit*proofview)*bool) -> (exn -> 'a1
      IOBase.coq_T) -> 'a1 IOBase.coq_T) ->
      (exn -> 'a1 IOBase.coq_T) -> 'a1
      IOBase.coq_T **)
  
  let put m s e r sk fk =
    sk (((),s),m) fk
  
  (** val current :
      proofview -> Environ.env -> __ ->
      (((logicalEnvironment*proofview)*bool)
      -> (exn -> 'a1 IOBase.coq_T) -> 'a1
      IOBase.coq_T) -> (exn -> 'a1
      IOBase.coq_T) -> 'a1 IOBase.coq_T **)
  
  let current s e r sk fk =
    sk ((e,s),true) fk
  
  (** val zero :
      exn -> proofview -> Environ.env -> __
      -> ((('a1*proofview)*bool) -> (exn ->
      'a2 IOBase.coq_T) -> 'a2 IOBase.coq_T)
      -> (exn -> 'a2 IOBase.coq_T) -> 'a2
      IOBase.coq_T **)
  
  let zero e s e0 r sk fk =
    fk e
  
  (** val plus :
      'a1 t -> (exn -> 'a1 t) -> proofview ->
      Environ.env -> __ ->
      ((('a1*proofview)*bool) -> (exn -> 'a2
      IOBase.coq_T) -> 'a2 IOBase.coq_T) ->
      (exn -> 'a2 IOBase.coq_T) -> 'a2
      IOBase.coq_T **)
  
  let plus x y s env r sk fk =
    Obj.magic x s env __ sk (fun e ->
      Obj.magic y e s env __ sk fk)
  
  (** val split :
      'a1 t -> proofview -> Environ.env -> __
      -> (((('a1*(exn -> 'a1 t), exn)
      Util.union*proofview)*bool) -> (exn ->
      'a2 IOBase.coq_T) -> 'a2 IOBase.coq_T)
      -> (exn -> 'a2 IOBase.coq_T) -> 'a2
      IOBase.coq_T **)
  
  let split x s e r sk fk =
    IOBase.bind
      (Obj.magic x s e __ (fun a fk0 ->
        IOBase.ret (Util.Inl
          (a,(fun e0 _ sk0 fk1 ->
          IOBase.bind (fk0 e0) (fun x0 ->
            match x0 with
            | Util.Inl p ->
              let a0,x1 = p in
              sk0 a0 (fun e1 ->
                x1 e1 __ sk0 fk1)
            | Util.Inr e1 -> fk1 e1)))))
        (fun e0 -> IOBase.ret (Util.Inr e0)))
      (fun x0 ->
      let sk0 = fun a fk0 ->
        let sk0 = fun a0 fk1 ->
          let x1,c = a0 in
          let sk0 = fun a1 fk2 ->
            let y,c' = a1 in
            sk (y,(if c then c' else false))
              fk2
          in
          (match x1 with
           | Util.Inl p ->
             let p0,y = p in
             let a1,s0 = p0 in
             sk0 (((Util.Inl
               (a1,(fun e0 x2 ->
               y e0))),s0),true) fk1
           | Util.Inr e0 ->
             sk0 (((Util.Inr e0),s),true) fk1)
        in
        let x1,c = a in
        let sk1 = fun a0 fk1 ->
          let y,c' = a0 in
          sk0 (y,(if c then c' else false))
            fk1
        in
        (match x1 with
         | Util.Inl p ->
           let a0,y = p in
           sk1 ((Util.Inl (a0,(fun e0 x2 ->
             y e0))),true) fk0
         | Util.Inr e0 ->
           sk1 ((Util.Inr e0),true) fk0)
      in
      (match x0 with
       | Util.Inl p ->
         let p0,y = p in
         let a,c = p0 in
         sk0 ((Util.Inl (a,y)),c) fk
       | Util.Inr e0 ->
         sk0 ((Util.Inr e0),true) fk))
  
  (** val lift :
      'a1 NonLogical.t -> proofview ->
      Environ.env -> __ ->
      ((('a1*proofview)*bool) -> (exn -> 'a2
      IOBase.coq_T) -> 'a2 IOBase.coq_T) ->
      (exn -> 'a2 IOBase.coq_T) -> 'a2
      IOBase.coq_T **)
  
  let lift x s e r sk fk =
    IOBase.bind x (fun x0 ->
      sk ((x0,s),true) fk)
  
  (** val run :
      'a1 t -> logicalEnvironment ->
      logicalState ->
      (('a1*logicalState)*logicalMessageType)
      NonLogical.t **)
  
  let run x e s =
    Obj.magic x s e __ (fun a x0 ->
      IOBase.ret a) (fun e0 ->
      IOBase.raise
        ((fun e -> Proof_errors.TacticFailure e)
          e0))
 end