src/ZF/simpdata.ML
author lcp
Tue, 16 Aug 1994 19:01:26 +0200
changeset 533 7357160bc56a
parent 516 1957113f0d7d
child 762 1cf9ebcc3ff3
permissions -rw-r--r--
ZF/pair.ML: moved some definitions here from simpdata.ML
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     1
(*  Title:      ZF/simpdata
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   1991  University of Cambridge
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     5
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
Rewriting for ZF set theory -- based on FOL rewriting
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     7
*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     8
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     9
(** Tactics for type checking -- from CTT **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    10
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
fun is_rigid_elem (Const("Trueprop",_) $ (Const("op :",_) $ a $ _)) = 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    12
      not (is_Var (head_of a))
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
  | is_rigid_elem _ = false;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    14
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    15
(*Try solving a:A by assumption provided a is rigid!*) 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    16
val test_assume_tac = SUBGOAL(fn (prem,i) =>
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    17
    if is_rigid_elem (Logic.strip_assums_concl prem)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    18
    then  assume_tac i  else  no_tac);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    19
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    20
(*Type checking solves a:?A (a rigid, ?A maybe flexible).  
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    21
  match_tac is too strict; would refuse to instantiate ?A*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    22
fun typechk_step_tac tyrls =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
    FIRSTGOAL (test_assume_tac ORELSE' filt_resolve_tac tyrls 3);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    24
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    25
fun typechk_tac tyrls = REPEAT (typechk_step_tac tyrls);
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
val ZF_typechecks = [if_type,lam_type,SigmaI,apply_type,split_type];
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
516
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 485
diff changeset
    29
(*Instantiates variables in typing conditions.
1957113f0d7d installation of new inductive/datatype sections
lcp
parents: 485
diff changeset
    30
  drawback: does not simplify conjunctions*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
fun type_auto_tac tyrls hyps = SELECT_GOAL
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    32
    (DEPTH_SOLVE (typechk_step_tac (tyrls@hyps)
6
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
    33
           ORELSE ares_tac [TrueI,refl,iff_refl,ballI,allI,conjI,impI] 1));
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    35
(** New version of mk_rew_rules **)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    37
(*Should False yield False<->True, or should it solve goals some other way?*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    38
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    39
(*Analyse a rigid formula*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    40
val atomize_pairs =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    41
  [("Ball",	[bspec]), 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    42
   ("All",	[spec]),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    43
   ("op -->",	[mp]),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    44
   ("op &",	[conjunct1,conjunct2])];
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
(*Analyse a:b, where b is rigid*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    47
val atomize_mem_pairs = 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    48
  [("Collect",	[CollectD1,CollectD2]),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    49
   ("op -",	[DiffD1,DiffD2]),
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    50
   ("op Int",	[IntD1,IntD2])];
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    51
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    52
(*Analyse a theorem to atomic rewrite rules*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    53
fun atomize th = 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    54
  let fun tryrules pairs t =
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    55
	  case head_of t of
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    56
	      Const(a,_) => 
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    57
		(case assoc(pairs,a) of
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    58
		     Some rls => flat (map atomize ([th] RL rls))
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    59
		   | None     => [th])
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    60
	    | _ => [th]
435
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 279
diff changeset
    61
  in case concl_of th of 
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 279
diff changeset
    62
       Const("Trueprop",_) $ P => 
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 279
diff changeset
    63
	  (case P of
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 279
diff changeset
    64
	       Const("op :",_) $ a $ b => tryrules atomize_mem_pairs b
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 279
diff changeset
    65
	     | Const("True",_)         => []
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 279
diff changeset
    66
	     | Const("False",_)        => []
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 279
diff changeset
    67
	     | A => tryrules atomize_pairs A)
ca5356bd315a Addition of cardinals and order types, various tidying
lcp
parents: 279
diff changeset
    68
     | _                       => [th]
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    69
  end;
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    70
14
1c0926788772 ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 6
diff changeset
    71
val ZF_simps = [empty_subsetI, consI1, succI1, ball_simp, if_true, if_false, 
467
92868dab2939 new cardinal arithmetic developments
lcp
parents: 435
diff changeset
    72
		beta, eta, restrict, fst_conv, snd_conv, split, Pair_iff,
485
5e00a676a211 Axiom of choice, cardinality results, etc.
lcp
parents: 467
diff changeset
    73
		triv_RepFun, subset_refl];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    74
6
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
    75
(*Sigma_cong, Pi_cong NOT included by default since they cause
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
    76
  flex-flex pairs and the "Check your prover" error -- because most
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
    77
  Sigma's and Pi's are abbreviated as * or -> *)
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
    78
val ZF_congs =
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
    79
   [ball_cong, bex_cong, Replace_cong, RepFun_cong, Collect_cong, lam_cong];
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    80
6
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
    81
val ZF_ss = FOL_ss 
279
7738aed3f84d Improved layout for inductive defs
lcp
parents: 14
diff changeset
    82
      setmksimps (map mk_meta_eq o atomize o gen_all)
14
1c0926788772 ex/{bin.ML,comb.ML,prop.ML}: replaced NewSext by Syntax.simple_sext
lcp
parents: 6
diff changeset
    83
      addsimps (ZF_simps @ mem_simps @ bquant_simps)
6
8ce8c4d13d4d Installation of new simplifier for ZF. Deleted all congruence rules not
lcp
parents: 0
diff changeset
    84
      addcongs ZF_congs;