CookBook/antiquote_setup.ML
author Christian Urban <urbanc@in.tum.de>
Wed, 11 Mar 2009 13:42:03 +0000
changeset 166 00d153e32a53
parent 165 890fbfef6d6b
child 171 18f90044c777
permissions -rw-r--r--
improvments to the solutions suggested by Sacha B?hme
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
106
bdd82350cf22 renamed in the pdf all instances of cookbook to tutorial (in order to sound more serious)
Christian Urban <urbanc@in.tum.de>
parents: 103
diff changeset
     1
(* Auxiliary antiquotations for the tutorial. *)
45
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     2
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
structure AntiquoteSetup: sig end =
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     4
struct
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
     6
(* functions for generating appropriate expressions *)
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
     7
45
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
fun ml_val_open (ys, xs) txt = 
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
  let fun ml_val_open_aux ys txt = 
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
          "fn " ^ (case ys of [] => "_" | _ => enclose "(" ")" (commas ys)) ^ " => (" ^ txt ^ ")";
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
  in
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
    (case xs of
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
       [] => ml_val_open_aux ys txt
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
     | _  => ml_val_open_aux ys ("let open " ^ (space_implode " " xs) ^ " in " ^ txt ^ " end"))
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
  end;
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
fun ml_val txt = ml_val_open ([],[]) txt;
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    19
fun ml_pat (lhs, pat) =
51
c346c156a7cd completes the recipie on antiquotations
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
    20
  let 
c346c156a7cd completes the recipie on antiquotations
Christian Urban <urbanc@in.tum.de>
parents: 49
diff changeset
    21
     val pat' = implode (map (fn "\\<dots>" => "_" | s => s) (Symbol.explode pat))
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    22
  in "val " ^ pat' ^ " = " ^ lhs end;
45
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    24
fun ml_struct txt = "functor DUMMY_FUNCTOR() = struct structure DUMMY = " ^ txt ^ " end";
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
fun ml_type txt = "val _ = NONE : (" ^ txt ^ ") option";
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    27
(* eval function *)
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    28
fun eval_fn ctxt pos exp =
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    29
  ML_Context.eval_in (SOME ctxt) false pos exp
57
065f472c09ab Repaired output of marginal comments in ML antiquotation.
berghofe
parents: 54
diff changeset
    30
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    31
(* string functions *)
103
fe10da5354a3 further cleanup
Christian Urban <urbanc@in.tum.de>
parents: 102
diff changeset
    32
fun string_explode str txt =
fe10da5354a3 further cleanup
Christian Urban <urbanc@in.tum.de>
parents: 102
diff changeset
    33
  map (fn s => str ^ s) (space_explode "\n" txt)
45
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    35
val transform_cmts_str =
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    36
     Source.of_string 
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    37
  #> ML_Lex.source 
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    38
  #> Source.exhaust 
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    39
  #> Chunks.transform_cmts 
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    40
  #> implode 
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    41
  #> string_explode "";
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    42
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    43
(* parser for single and two arguments *)
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    44
val single_arg = Scan.lift (OuterParse.position Args.name)
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    45
val two_args = Scan.lift (OuterParse.position (Args.name -- Args.name))
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    46
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    47
(* output function *)
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    48
val output_fn = Chunks.output_list (fn _ => fn s => Pretty.str s)
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    49
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    50
(* checks and prints open expressions *)
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
    51
fun output_ml () =
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    52
let
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
    53
  fun output {state: Toplevel.state, source = src, context = ctxt} ((txt,ovars),pos) =
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    54
    (eval_fn ctxt pos (ml_val_open ovars txt);
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    55
     output_fn src ctxt (transform_cmts_str txt))
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    56
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    57
  val parser = Scan.lift (OuterParse.position (Args.name --
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    58
      (Scan.optional (Args.$$$ "for" |-- OuterParse.!!! (Scan.repeat1 Args.name)) [] --
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    59
       Scan.optional (Args.$$$ "in"  |-- OuterParse.!!! (Scan.repeat1 Args.name)) []))) 
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    60
in
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
    61
  ThyOutput.antiquotation "ML" parser output
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    62
end
45
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    64
(* checks and prints types and structures *)
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
    65
fun output_exp ml =
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    66
let 
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
    67
  fun output {state: Toplevel.state, source = src, context = ctxt} (txt,pos) = 
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    68
    (eval_fn ctxt pos (ml txt);
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    69
     output_fn src ctxt (string_explode "" txt))
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    70
in
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
    71
  ThyOutput.antiquotation "ML_type" single_arg output
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    72
end
45
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    74
(* checks and expression agains a result pattern *)
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
    75
fun output_ml_response () =
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    76
let
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
    77
  fun output {state: Toplevel.state, source = src, context = ctxt} ((lhs,pat),pos) = 
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    78
    (eval_fn ctxt pos (ml_pat (lhs,pat));
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    79
     output_fn src ctxt ((string_explode "" lhs) @ (string_explode "> " pat)))
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    80
in
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
    81
  ThyOutput.antiquotation "ML_response" two_args output
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    82
end
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    83
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    84
(* checks the expressions, but does not check it against a result pattern *)
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
    85
fun output_ml_response_fake () =
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    86
let
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
    87
  fun output {state: Toplevel.state, source = src, context = ctxt} ((lhs, pat), pos) = 
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    88
    (eval_fn ctxt pos (ml_val lhs);
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    89
     output_fn src ctxt ((string_explode "" lhs) @ (string_explode "> " pat)))
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    90
in
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
    91
  ThyOutput.antiquotation "ML_response_fake" two_args output
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    92
end
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    93
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    94
(* just prints an expression and a result pattern *)
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
    95
fun output_ml_response_fake_both () =
103
fe10da5354a3 further cleanup
Christian Urban <urbanc@in.tum.de>
parents: 102
diff changeset
    96
let 
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
    97
  fun ouput {state: Toplevel.state, source = src, context = ctxt}   ((lhs,pat), _) = 
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
    98
    output_fn src ctxt ((string_explode "" lhs) @ (string_explode "> " pat))
103
fe10da5354a3 further cleanup
Christian Urban <urbanc@in.tum.de>
parents: 102
diff changeset
    99
in
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   100
  ThyOutput.antiquotation "ML_response_fake_both" two_args ouput
103
fe10da5354a3 further cleanup
Christian Urban <urbanc@in.tum.de>
parents: 102
diff changeset
   101
end
54
1783211b3494 tuned; added document antiquotation ML_response_fake_both
Christian Urban <urbanc@in.tum.de>
parents: 53
diff changeset
   102
112
a90d0fb24e75 improved
Christian Urban <urbanc@in.tum.de>
parents: 106
diff changeset
   103
(* checks whether a file exists in the Isabelle distribution *)
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   104
fun check_file_exists () =
102
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 98
diff changeset
   105
let 
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 98
diff changeset
   106
  fun check txt =
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 98
diff changeset
   107
   if File.exists (Path.append (Path.explode ("~~/src")) (Path.explode txt)) then ()
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 98
diff changeset
   108
   else error ("Source file " ^ (quote txt) ^ " does not exist.")
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 98
diff changeset
   109
in
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   110
  ThyOutput.antiquotation "ML_file" (Scan.lift Args.name)
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   111
      (fn _ => fn s => (check s; ThyOutput.output [Pretty.str s]))
102
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 98
diff changeset
   112
end
45
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   113
102
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 98
diff changeset
   114
(* replaces the official subgoal antiquotation with one *)
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 98
diff changeset
   115
(* that is closer to the actual output                  *)
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   116
(*
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   117
fun output_goals  {state = node, source: Args.src, context: Proof.context}  _ = 
96
018bfa718982 (re)defined the document antiquotation @subgoal in order to be closer to what is actually printed
Christian Urban <urbanc@in.tum.de>
parents: 90
diff changeset
   118
let 
98
0a5c95f4d70c calculated the exact number of goals in the subgoal antiquotation
Christian Urban <urbanc@in.tum.de>
parents: 96
diff changeset
   119
  fun subgoals 0 = ""
96
018bfa718982 (re)defined the document antiquotation @subgoal in order to be closer to what is actually printed
Christian Urban <urbanc@in.tum.de>
parents: 90
diff changeset
   120
    | subgoals 1 = "goal (1 subgoal):"
018bfa718982 (re)defined the document antiquotation @subgoal in order to be closer to what is actually printed
Christian Urban <urbanc@in.tum.de>
parents: 90
diff changeset
   121
    | subgoals n = "goal (" ^ string_of_int n ^ " subgoals):";
018bfa718982 (re)defined the document antiquotation @subgoal in order to be closer to what is actually printed
Christian Urban <urbanc@in.tum.de>
parents: 90
diff changeset
   122
 
018bfa718982 (re)defined the document antiquotation @subgoal in order to be closer to what is actually printed
Christian Urban <urbanc@in.tum.de>
parents: 90
diff changeset
   123
  fun proof_state node =
018bfa718982 (re)defined the document antiquotation @subgoal in order to be closer to what is actually printed
Christian Urban <urbanc@in.tum.de>
parents: 90
diff changeset
   124
     (case Option.map Toplevel.proof_node node of
018bfa718982 (re)defined the document antiquotation @subgoal in order to be closer to what is actually printed
Christian Urban <urbanc@in.tum.de>
parents: 90
diff changeset
   125
          SOME (SOME prf) => ProofNode.current prf
018bfa718982 (re)defined the document antiquotation @subgoal in order to be closer to what is actually printed
Christian Urban <urbanc@in.tum.de>
parents: 90
diff changeset
   126
        | _ => error "No proof state");
018bfa718982 (re)defined the document antiquotation @subgoal in order to be closer to what is actually printed
Christian Urban <urbanc@in.tum.de>
parents: 90
diff changeset
   127
98
0a5c95f4d70c calculated the exact number of goals in the subgoal antiquotation
Christian Urban <urbanc@in.tum.de>
parents: 96
diff changeset
   128
  val state = proof_state node;
102
5e309df58557 general cleaning up; deleted antiquotation ML_text; adjusted pathnames of various files in the distribution
Christian Urban <urbanc@in.tum.de>
parents: 98
diff changeset
   129
  val goals = Proof.pretty_goals false state;
98
0a5c95f4d70c calculated the exact number of goals in the subgoal antiquotation
Christian Urban <urbanc@in.tum.de>
parents: 96
diff changeset
   130
0a5c95f4d70c calculated the exact number of goals in the subgoal antiquotation
Christian Urban <urbanc@in.tum.de>
parents: 96
diff changeset
   131
  val {prop, ...} = rep_thm (Proof.get_goal state |> snd |> snd);
0a5c95f4d70c calculated the exact number of goals in the subgoal antiquotation
Christian Urban <urbanc@in.tum.de>
parents: 96
diff changeset
   132
  val (As, B) = Logic.strip_horn prop;
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   133
  val output'  = (case (length As) of
98
0a5c95f4d70c calculated the exact number of goals in the subgoal antiquotation
Christian Urban <urbanc@in.tum.de>
parents: 96
diff changeset
   134
                      0 => goals 
0a5c95f4d70c calculated the exact number of goals in the subgoal antiquotation
Christian Urban <urbanc@in.tum.de>
parents: 96
diff changeset
   135
                    | n => (Pretty.str (subgoals n))::goals)  
96
018bfa718982 (re)defined the document antiquotation @subgoal in order to be closer to what is actually printed
Christian Urban <urbanc@in.tum.de>
parents: 90
diff changeset
   136
in 
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   137
  output 
96
018bfa718982 (re)defined the document antiquotation @subgoal in order to be closer to what is actually printed
Christian Urban <urbanc@in.tum.de>
parents: 90
diff changeset
   138
end
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   139
*)
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   140
96
018bfa718982 (re)defined the document antiquotation @subgoal in order to be closer to what is actually printed
Christian Urban <urbanc@in.tum.de>
parents: 90
diff changeset
   141
165
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   142
val _ = output_ml ();
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   143
val _ = check_file_exists ();
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   144
val _ = output_ml_response ();
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   145
val _ = output_ml_response_fake ();
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   146
val _ = output_ml_response_fake_both ();
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   147
val _ = output_exp ml_struct;
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   148
val _ = output_exp ml_type;
890fbfef6d6b partially adapted to new antiquotation infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 112
diff changeset
   149
(*val _ = output_goals*)
45
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
   
78aeca00bb54 deleted old antiquote_setup and renamed antiquote_setup_plus to antiquuote_setup
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
end;