src/ZF/ind_syntax.ML
author lcp
Thu, 18 Aug 1994 17:41:40 +0200
changeset 543 e961b2092869
parent 516 1957113f0d7d
child 568 756b0e2a6cac
permissions -rw-r--r--
ZF/ind_syntax/unvarifyT, unvarify: moved to Pure/logic.ML ZF/ind_syntax/prove_term: deleted ZF/constructor, indrule, intr_elim: now call prove_goalw_cterm and Logic.unvarify
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     1
(*  Title: 	ZF/ind-syntax.ML
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     2
    ID:         $Id$
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     3
    Author: 	Lawrence C Paulson, Cambridge University Computer Laboratory
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     4
    Copyright   1993  University of Cambridge
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
Abstract Syntax functions for Inductive Definitions
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
     9
(*The structure protects these items from redeclaration (somewhat!).  The 
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    10
  datatype definitions in theory files refer to these items by name!
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    11
*)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    12
structure Ind_Syntax =
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    13
struct
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    14
(*Make a definition lhs==rhs, checking that vars on lhs contain those of rhs*)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    15
fun mk_defpair (lhs, rhs) = 
454
0d19ab250cc9 removed flatten_term and replaced add_axioms by add_axioms_i
clasohm
parents: 444
diff changeset
    16
  let val Const(name, _) = head_of lhs
0d19ab250cc9 removed flatten_term and replaced add_axioms by add_axioms_i
clasohm
parents: 444
diff changeset
    17
  in (name ^ "_def", Logic.mk_equals (lhs, rhs)) end;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    19
fun get_def thy s = get_axiom thy (s^"_def");
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    20
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    21
fun lookup_const sign a = Symtab.lookup(#const_tab (Sign.rep_sg sign), a);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
(** Abstract syntax definitions for FOL and ZF **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
val iT = Type("i",[])
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
and oT = Type("o",[]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
fun ap t u = t$u;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    29
fun app t (u1,u2) = t $ u1 $ u2;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    30
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
(*Given u expecting arguments of types [T1,...,Tn], create term of 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    32
  type T1*...*Tn => i using split*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
fun ap_split split u [ ]   = Abs("null", iT, u)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
  | ap_split split u [_]   = u
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    35
  | ap_split split u [_,_] = split $ u
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
  | ap_split split u (T::Ts) = 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    37
      split $ (Abs("v", T, ap_split split (u $ Bound(length Ts - 2)) Ts));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    38
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    39
val conj = Const("op &", [oT,oT]--->oT)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    40
and disj = Const("op |", [oT,oT]--->oT)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    41
and imp = Const("op -->", [oT,oT]--->oT);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    42
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    43
val eq_const = Const("op =", [iT,iT]--->oT);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    44
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
val mem_const = Const("op :", [iT,iT]--->oT);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    47
val exists_const = Const("Ex", [iT-->oT]--->oT);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    48
fun mk_exists (Free(x,T),P) = exists_const $ (absfree (x,T,P));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    49
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    50
val all_const = Const("All", [iT-->oT]--->oT);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    51
fun mk_all (Free(x,T),P) = all_const $ (absfree (x,T,P));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    52
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    53
(*Creates All(%v.v:A --> P(v)) rather than Ball(A,P) *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    54
fun mk_all_imp (A,P) = 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    55
    all_const $ Abs("v", iT, imp $ (mem_const $ Bound 0 $ A) $ (P $ Bound 0));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    56
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    57
val Part_const = Const("Part", [iT,iT-->iT]--->iT);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    58
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    59
val Collect_const = Const("Collect", [iT,iT-->oT]--->iT);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    60
fun mk_Collect (a,D,t) = Collect_const $ D $ absfree(a, iT, t);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    61
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    62
val Trueprop = Const("Trueprop",oT-->propT);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    63
fun mk_tprop P = Trueprop $ P;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    64
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    65
(*Read an assumption in the given theory*)
231
cb6a24451544 Updated refs to old Sign functions
lcp
parents: 202
diff changeset
    66
fun assume_read thy a = assume (read_cterm (sign_of thy) (a,propT));
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    67
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    68
fun readtm sign T a = 
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    69
    read_cterm sign (a,T) |> term_of
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    70
    handle ERROR => error ("The error above occurred for " ^ a);
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    71
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    72
(*Skipping initial blanks, find the first identifier*)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    73
fun scan_to_id s = 
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    74
    s |> explode |> take_prefix is_blank |> #2 |> Lexicon.scan_id |> #1
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    75
    handle LEXICAL_ERROR => error ("Expected to find an identifier in " ^ s);
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    76
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    77
fun is_backslash c = c = "\\";
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    78
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    79
(*Apply string escapes to a quoted string; see Def of Standard ML, page 3
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    80
  Does not handle the \ddd form;  no error checking*)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    81
fun escape [] = []
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    82
  | escape cs = (case take_prefix (not o is_backslash) cs of
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    83
	 (front, []) => front
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    84
       | (front, _::"n"::rest) => front @ ("\n" :: escape rest)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    85
       | (front, _::"t"::rest) => front @ ("\t" :: escape rest)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    86
       | (front, _::"^"::c::rest) => front @ (chr(ord(c)-64) :: escape rest)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    87
       | (front, _::"\""::rest) => front @ ("\"" :: escape rest)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    88
       | (front, _::"\\"::rest) => front @ ("\\" :: escape rest)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    89
       | (front, b::c::rest) => 
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    90
	   if is_blank c   (*remove any further blanks and the following \ *)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    91
	   then front @ escape (tl (snd (take_prefix is_blank rest)))
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    92
	   else error ("Unrecognized string escape: " ^ implode(b::c::rest)));
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    93
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    94
(*Remove the first and last charaters -- presumed to be quotes*)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    95
val trim = implode o escape o rev o tl o rev o tl o explode;
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    96
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    97
(*simple error-checking in the premises of an inductive definition*)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    98
fun chk_prem rec_hd (Const("op &",_) $ _ $ _) =
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
    99
	error"Premises may not be conjuctive"
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   100
  | chk_prem rec_hd (Const("op :",_) $ t $ X) = 
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   101
	deny (Logic.occs(rec_hd,t)) "Recursion term on left of member symbol"
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   102
  | chk_prem rec_hd t = 
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   103
	deny (Logic.occs(rec_hd,t)) "Recursion term in side formula";
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   104
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   105
(*Make distinct individual variables a1, a2, a3, ..., an. *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   106
fun mk_frees a [] = []
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   107
  | mk_frees a (T::Ts) = Free(a,T) :: mk_frees (bump_string a) Ts;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   108
14
1c0926788772 ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 6
diff changeset
   109
(*Return the conclusion of a rule, of the form t:X*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   110
fun rule_concl rl = 
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 231
diff changeset
   111
    let val Const("Trueprop",_) $ (Const("op :",_) $ t $ X) = 
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 231
diff changeset
   112
		Logic.strip_imp_concl rl
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 231
diff changeset
   113
    in  (t,X)  end;
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 231
diff changeset
   114
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 231
diff changeset
   115
(*As above, but return error message if bad*)
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 231
diff changeset
   116
fun rule_concl_msg sign rl = rule_concl rl
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 231
diff changeset
   117
    handle Bind => error ("Ill-formed conclusion of introduction rule: " ^ 
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 231
diff changeset
   118
			  Sign.string_of_term sign rl);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   119
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   120
(*For deriving cases rules.  CollectD2 discards the domain, which is redundant;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   121
  read_instantiate replaces a propositional variable by a formula variable*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   122
val equals_CollectD = 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   123
    read_instantiate [("W","?Q")]
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   124
        (make_elim (equalityD1 RS subsetD RS CollectD2));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   125
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   126
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   127
(*From HOL/ex/meson.ML: raises exception if no rules apply -- unlike RL*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   128
fun tryres (th, rl::rls) = (th RS rl handle THM _ => tryres(th,rls))
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   129
  | tryres (th, []) = raise THM("tryres", 0, [th]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   130
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   131
fun gen_make_elim elim_rls rl = 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   132
      standard (tryres (rl, elim_rls @ [revcut_rl]));
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   133
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   134
(** For datatype definitions **)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   135
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   136
fun dest_mem (Const("op :",_) $ x $ A) = (x,A)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   137
  | dest_mem _ = error "Constructor specifications must have the form x:A";
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   138
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   139
(*read a constructor specification*)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   140
fun read_construct sign (id, sprems, syn) =
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   141
    let val prems = map (readtm sign oT) sprems
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   142
	val args = map (#1 o dest_mem) prems
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   143
	val T = (map (#2 o dest_Free) args) ---> iT
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   144
		handle TERM _ => error 
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   145
		    "Bad variable in constructor specification"
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   146
        val name = const_name id syn  (*handle infix constructors*)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   147
    in ((id,T,syn), name, args, prems) end;
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   148
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   149
val read_constructs = map o map o read_construct;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   150
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   151
(*convert constructor specifications into introduction rules*)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   152
fun mk_intr_tms (rec_tm, constructs) =
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   153
  let fun mk_intr ((id,T,syn), name, args, prems) =
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   154
	  Logic.list_implies
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   155
	      (map mk_tprop prems,
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   156
	       mk_tprop (mem_const $ list_comb(Const(name,T), args) $ rec_tm)) 
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   157
  in  map mk_intr constructs  end;
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   158
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   159
val mk_all_intr_tms = flat o map mk_intr_tms o op ~~;
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   160
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   161
val Un		= Const("op Un", [iT,iT]--->iT)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   162
and empty	= Const("0", iT)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   163
and univ	= Const("univ", iT-->iT)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   164
and quniv	= Const("quniv", iT-->iT);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   165
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   166
(*Make a datatype's domain: form the union of its set parameters*)
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   167
fun union_params rec_tm =
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   168
  let val (_,args) = strip_comb rec_tm
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   169
  in  case (filter (fn arg => type_of arg = iT) args) of
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   170
         []    => empty
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   171
       | iargs => fold_bal (app Un) iargs
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   172
  end;
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   173
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   174
fun data_domain rec_tms =
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   175
  replicate (length rec_tms) (univ $ union_params (hd rec_tms));
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   176
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   177
fun Codata_domain rec_tms =
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   178
  replicate (length rec_tms) (quniv $ union_params (hd rec_tms));
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   179
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   180
(*Could go to FOL, but it's hardly general*)
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   181
val def_swap_iff = prove_goal IFOL.thy "a==b ==> a=c <-> c=b"
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   182
 (fn [def] => [(rewtac def), (rtac iffI 1), (REPEAT (etac sym 1))]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   183
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   184
val def_trans = prove_goal IFOL.thy "[| f==g;  g(a)=b |] ==> f(a)=b"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   185
  (fn [rew,prem] => [ rewtac rew, rtac prem 1 ]);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   186
55
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 14
diff changeset
   187
(*Delete needless equality assumptions*)
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 14
diff changeset
   188
val refl_thin = prove_goal IFOL.thy "!!P. [| a=a;  P |] ==> P"
331d93292ee0 ZF/ind-syntax/refl_thin: new
lcp
parents: 14
diff changeset
   189
     (fn _ => [assume_tac 1]);
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   190
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   191
end;
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 466
diff changeset
   192