src/Pure/IsaPlanner/isaplib.ML
author urbanc
Wed, 11 Jan 2006 17:10:11 +0100
changeset 18655 73cebafb9a89
parent 17796 86daafee72d6
child 19475 8aa2b380614a
permissions -rw-r--r--
merged the silly lemmas into the eqvt proof of subtype
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
     1
(* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- *) 
16179
fa7e70be26b0 header;
wenzelm
parents: 16004
diff changeset
     2
(*  Title:      Pure/IsaPlanner/isaplib.ML
fa7e70be26b0 header;
wenzelm
parents: 16004
diff changeset
     3
    ID:		$Id$
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
     4
    Author:     Lucas Dixon, University of Edinburgh
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
     5
                lucasd@dai.ed.ac.uk
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
     6
*)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
     7
(* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- *) 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
     8
(*  DESCRIPTION:
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
     9
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    10
    A few useful system-independent utilities.
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    11
*)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    12
(* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- *) 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    13
signature ISAP_LIB =
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    14
sig
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    15
  (* seq operations *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    16
  val ALL_BUT_LAST : ('a -> 'b Seq.seq) -> 'a -> 'b Seq.seq
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    17
  val FST : ('a -> 'b Seq.seq) -> 'a -> 'b Seq.seq
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    18
  val NTH : int -> ('a -> 'b Seq.seq) -> 'a -> 'b Seq.seq
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    19
  val all_but_last_of_seq : 'a Seq.seq -> 'a Seq.seq
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    20
  val nat_seq : int Seq.seq
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
    21
  val nth_of_seq : int -> 'a Seq.seq -> 'a option
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    22
  val pair_seq : 'a Seq.seq -> 'b Seq.seq -> ('a * 'b) Seq.seq
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    23
  val seq_is_empty : 'a Seq.seq -> bool
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    24
  val number_seq : 'a Seq.seq -> (int * 'a) Seq.seq
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    25
16004
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
    26
  datatype 'a skipseqT = 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
    27
           skipmore of int
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
    28
         | skipseq of 'a Seq.seq Seq.seq;
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
    29
  val skipto_seqseq : int -> 'a Seq.seq Seq.seq -> 'a skipseqT
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
    30
  val seqflat_seq : 'a Seq.seq Seq.seq -> 'a Seq.seq 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
    31
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    32
  (* lists *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    33
  val mk_num_list : int -> int list
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    34
  val number_list : int -> 'a list -> (int * 'a) list
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    35
  val repeated_list : int -> 'a -> 'a list
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    36
  val all_pairs : 'a list -> 'b list -> ('a * 'b) list
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    37
	val get_ends_of : ('a * 'a -> bool) ->
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    38
										('a * 'a) -> 'a list -> ('a * 'a)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    39
  val flatmap : ('a -> 'b list) -> 'a list -> 'b list
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    40
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    41
	val lrem : ('a * 'b -> bool) -> 'a list -> 'b list -> 'b list
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    42
  val forall_list : ('a -> bool) -> 'a list -> bool
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    43
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    44
  (* the list of lists with one of each of the original sublists *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    45
  val one_of_each : 'a list list -> 'a list list
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    46
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    47
  (* type changing *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    48
  exception NOT_A_DIGIT of string
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    49
  val int_of_string : string -> int
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    50
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    51
  (* string manipulations *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    52
  val remove_end_spaces : string -> string
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    53
  val str_indent : string -> string
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    54
  val string_of_intlist : int list -> string
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    55
  val string_of_list : ('a -> string) -> 'a list -> string
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    56
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    57
  (* options *)
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
    58
  val aptosome : 'a option -> ('a -> 'b) -> 'b option
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
    59
  val seq_mapfilter : ('a -> 'b option) -> 'a Seq.seq -> 'b Seq.seq
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
    60
  val seq_map_to_some_filter : ('a -> 'b) -> 'a option Seq.seq 
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    61
                               -> 'b Seq.seq
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    62
end;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    63
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    64
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    65
17796
86daafee72d6 minor tweaks for Poplog/PML;
wenzelm
parents: 16179
diff changeset
    66
structure IsaPLib : ISAP_LIB = 
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    67
struct
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    68
 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    69
(* Seq *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    70
fun seq_map_to_some_filter f s0 =
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    71
    let 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    72
      fun recf s () = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    73
          case (Seq.pull s) of 
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
    74
            NONE => NONE
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
    75
          | SOME (NONE,s') => recf s' ()
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
    76
          | SOME (SOME d, s') => 
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
    77
            SOME (f d, Seq.make (recf s'))
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    78
    in Seq.make (recf s0) end;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    79
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    80
fun seq_mapfilter f s0 =
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    81
    let 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    82
      fun recf s () = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    83
          case (Seq.pull s) of 
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
    84
            NONE => NONE
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
    85
          | SOME (a,s') => 
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
    86
            (case f a of NONE => recf s' ()
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
    87
                       | SOME b => SOME (b, Seq.make (recf s')))
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    88
    in Seq.make (recf s0) end;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    89
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    90
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    91
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    92
(* a simple function to pair with each element of a list, a number *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    93
fun number_list i [] = []
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    94
	| number_list i (h::t) = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    95
		(i,h)::(number_list (i+1) t)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    96
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    97
(* check to see if a sequence is empty *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    98
fun seq_is_empty s = is_none (Seq.pull s);
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
    99
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   100
(* the sequence of natural numbers *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   101
val nat_seq = 
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   102
      let fun nseq i () = SOME (i, Seq.make (nseq (i+1)))
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   103
      in Seq.make (nseq 1)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   104
      end;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   105
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   106
(* create a sequence of pairs of the elements of the two sequences
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   107
   If one sequence becomes empty, then so does the pairing of them. 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   108
   
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   109
   This is particularly useful if you wish to perform counting or
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   110
   other repeated operations on a sequence and you want to combvine
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   111
   this infinite sequence with a possibly finite one.
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   112
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   113
   behaviour: 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   114
   s1: a1, a2, ... an
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   115
   s2: b1, b2, ... bn ...
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   116
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   117
   pair_seq s1 s2: (a1,b1), (a2,b2), ... (an,bn)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   118
*)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   119
fun pair_seq seq1 seq2 = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   120
    let
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   121
      fun pseq s1 s2 () = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   122
	        case Seq.pull s1 of 
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   123
	          NONE => NONE
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   124
	        | SOME (s1h, s1t) => 
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   125
	          case Seq.pull s2 of 
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   126
		          NONE => NONE
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   127
	          | SOME (s2h, s2t) =>
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   128
		          SOME ((s1h, s2h), Seq.make (pseq s1t s2t))
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   129
    in
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   130
      Seq.make (pseq seq1 seq2)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   131
    end;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   132
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   133
(* number a sequence *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   134
fun number_seq s = pair_seq nat_seq s;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   135
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   136
(* cuts off the last element of a sequence *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   137
fun all_but_last_of_seq s = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   138
    let 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   139
      fun f () = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   140
	  case Seq.pull s of
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   141
	    NONE => NONE
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   142
	  | SOME (a, s2) => 
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   143
	    (case Seq.pull s2 of 
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   144
	       NONE => NONE
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   145
	     | SOME (a2,s3) => 
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   146
	       SOME (a, all_but_last_of_seq (Seq.cons (a2,s3))))
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   147
    in
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   148
      Seq.make f
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   149
    end;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   150
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   151
 fun ALL_BUT_LAST r st = all_but_last_of_seq (r st);
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   152
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   153
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   154
  (* nth elem for sequenes, return none if out of bounds *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   155
  fun nth_of_seq i l = 
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   156
           if (seq_is_empty l) then NONE 
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   157
           else if i <= 1 then SOME (Seq.hd l)
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   158
           else nth_of_seq (i-1) (Seq.tl l);
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   159
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   160
  (* for use with tactics... gives no_tac if element isn't there *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   161
  fun NTH n f st = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   162
      let val r = nth_of_seq n (f st) in 
15570
8d8c70b41bab Move towards standard functions.
skalberg
parents: 15531
diff changeset
   163
        if (is_none r) then Seq.empty else (Seq.single (valOf r))
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   164
      end;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   165
 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   166
  (* First result of a tactic... uses NTH, so if there is no elements,
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   167
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   168
     then no_tac is returned. *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   169
  fun FST f = NTH 1 f;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   170
16004
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   171
datatype 'a skipseqT = skipmore of int
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   172
  | skipseq of 'a Seq.seq Seq.seq;
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   173
(* given a seqseq, skip the first m non-empty seq's *)
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   174
fun skipto_seqseq m s = 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   175
    let 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   176
      fun skip_occs n sq = 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   177
          case Seq.pull sq of 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   178
            NONE => skipmore n
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   179
          | SOME (h,t) => 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   180
            (case Seq.pull h of NONE => skip_occs n t
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   181
             | SOME _ => if n <= 1 then skipseq (Seq.cons (h, t))
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   182
                         else skip_occs (n - 1) t)
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   183
    in (skip_occs m s) end;
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   184
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   185
(* handy function for re-arranging Sequence operations *)
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   186
(* [[a,b,c],[d,e],...] => flatten [[a,d,...], [b,e,...], [c, ...]] *)
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   187
fun seqflat_seq ss = 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   188
    let 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   189
      fun pulltl LL () = 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   190
          (case Seq.pull LL of 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   191
             NONE => NONE
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   192
           | SOME (hL,tLL) => 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   193
             (case Seq.pull hL of 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   194
                NONE => pulltl tLL ()
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   195
              | SOME (h,tL) => 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   196
                SOME (h, Seq.make (recf (tLL, (Seq.single tL))))))
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   197
      and recf (fstLL,sndLL) () = 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   198
          (case Seq.pull fstLL of 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   199
             NONE => pulltl sndLL ()
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   200
           | SOME (hL, tLL) => 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   201
             (case Seq.pull hL of 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   202
                NONE => recf (tLL, sndLL) ()
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   203
              | SOME (h,tL) => 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   204
                SOME (h, Seq.make (recf (tLL, Seq.append (sndLL, Seq.single tL))))))
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   205
    in Seq.make (pulltl ss) end;
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   206
(* tested with: 
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   207
val ss = Seq.of_list [Seq.of_list [1,2,3], Seq.of_list [4,5], Seq.of_list [7,8,9,10]];
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   208
Seq.list_of (seqflat_seq ss);
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   209
val it = [1, 4, 7, 2, 5, 8, 3, 9, 10] : int list
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   210
*)
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   211
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   212
031f56012483 lucas - fixed subst in assumptions to count redexes from left to right.
dixon
parents: 15570
diff changeset
   213
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   214
  (* create a list opf the form (n, n-1, n-2, ... ) *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   215
  fun mk_num_list n =  
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   216
      if n < 1 then [] else (n :: (mk_num_list (n-1))); 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   217
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   218
  fun repeated_list n a =  
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   219
      if n < 1 then [] else (a :: (repeated_list (n-1) a)); 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   220
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   221
  (* create all possible pairs with fst element from the first list
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   222
     and snd element from teh second list *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   223
  fun all_pairs xs ys = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   224
      let 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   225
        fun all_pairs_aux yss [] _ acc = acc
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   226
          | all_pairs_aux yss (x::xs) [] acc = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   227
            all_pairs_aux yss xs yss acc
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   228
          | all_pairs_aux yss (xs as (x1::x1s)) (y::ys) acc = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   229
                               all_pairs_aux yss xs ys ((x1,y)::acc)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   230
      in
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   231
        all_pairs_aux ys xs ys []
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   232
      end;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   233
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   234
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   235
  (* create all possible pairs with fst element from the first list
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   236
     and snd element from teh second list *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   237
  (* FIXME: make tail recursive and quick *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   238
  fun one_of_each [] = []
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   239
    | one_of_each [[]] = []
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   240
    | one_of_each [(h::t)] = [h] :: (one_of_each [t])
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   241
    | one_of_each ([] :: xs) = []
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   242
    | one_of_each ((h :: t) :: xs) = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   243
      (map (fn z => h :: z) (one_of_each xs)) 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   244
      @ (one_of_each (t :: xs));
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   245
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   246
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   247
(* function to get the upper/lower bounds of a list 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   248
given: 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   249
gr : 'a * 'a -> bool  = greater than check
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   250
e as (u,l) : ('a * 'a) = upper and lower bits
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   251
l : 'a list = the list to get the upper and lower bounds of
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   252
returns a pair ('a * 'a) of the biggest and lowest value w.r.t "gr"
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   253
*)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   254
fun get_ends_of gr (e as (u,l)) [] = e
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   255
  | get_ends_of gr (e as (u,l)) (h :: t) = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   256
    if gr(h,u) then get_ends_of gr (h,l) t
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   257
    else if gr(l,h) then get_ends_of gr (u,h) t
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   258
    else get_ends_of gr (u,l) t;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   259
15570
8d8c70b41bab Move towards standard functions.
skalberg
parents: 15531
diff changeset
   260
fun flatmap f = List.concat o map f;
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   261
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   262
  (* quick removal of "rs" elements from "ls" when (eqf (r,l)) is true 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   263
		 Ignores ordering. *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   264
  fun lrem eqf rs ls = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   265
			let fun list_remove rs ([],[]) = []
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   266
						| list_remove [] (xs,_) = xs
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   267
						| list_remove (r::rs) ([],leftovers) = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   268
							list_remove rs (leftovers,[])
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   269
						| list_remove (r1::rs) ((x::xs),leftovers) = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   270
							if eqf (r1, x) then list_remove (r1::rs) (xs,leftovers)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   271
							else list_remove (r1::rs) (xs, x::leftovers)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   272
			in
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   273
				list_remove rs (ls,[])
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   274
			end;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   275
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   276
fun forall_list f [] = true
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   277
  | forall_list f (a::t) = f a orelse forall_list f t;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   278
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   279
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   280
  (* crappy string indeter *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   281
  fun str_indent s = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   282
    implode (map (fn s => if s = "\n" then "\n  " else s) (explode s));
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   283
      
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   284
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   285
  fun remove_end_spaces s = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   286
      let 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   287
				fun rem_starts [] = [] 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   288
					| rem_starts (" " :: t) = rem_starts t
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   289
					| rem_starts ("\t" :: t) = rem_starts t
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   290
					| rem_starts ("\n" :: t) = rem_starts t
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   291
					| rem_starts l = l
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   292
				fun rem_ends l = rev (rem_starts (rev l))
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   293
      in
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   294
				implode (rem_ends (rem_starts (explode s)))
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   295
      end;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   296
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   297
(* convert a string to an integer *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   298
  exception NOT_A_DIGIT of string;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   299
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   300
  fun int_of_string s = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   301
      let 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   302
				fun digits_to_int [] x = x
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   303
					| digits_to_int (h :: t) x = digits_to_int t (x * 10 + h);
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   304
	
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   305
				fun char_to_digit c = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   306
						case c of 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   307
							"0" => 0
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   308
						| "1" => 1
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   309
						| "2" => 2
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   310
						| "3" => 3
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   311
						| "4" => 4
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   312
						| "5" => 5
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   313
						| "6" => 6
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   314
						| "7" => 7
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   315
						| "8" => 8
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   316
						| "9" => 9
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   317
						| _ => raise NOT_A_DIGIT c
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   318
      in
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   319
				digits_to_int (map char_to_digit (explode (remove_end_spaces s))) 0
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   320
      end;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   321
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   322
  (* Debugging/printing code for this datatype *)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   323
  fun string_of_list f l = 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   324
      let 
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   325
				fun auxf [] = ""
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   326
					| auxf [a] = (f a)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   327
					| auxf (h :: (t as (h2 :: t2))) = (f h) ^ ", " ^ (auxf t)
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   328
      in
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   329
				"[" ^ (auxf l) ^ "]"
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   330
      end;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   331
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   332
   val string_of_intlist = string_of_list string_of_int;
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   333
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   334
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   335
  (* options *)
15531
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   336
  fun aptosome NONE f = NONE
08c8dad8e399 Deleted Library.option type.
skalberg
parents: 15481
diff changeset
   337
    | aptosome (SOME x) f = SOME (f x);
15481
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   338
fc075ae929e4 the new subst tactic, by Lucas Dixon
paulson
parents:
diff changeset
   339
end;