src/HOL/Library/Old_Recdef.thy
author wenzelm
Sat, 12 Jan 2013 14:53:56 +0100
changeset 50843 1465521b92a1
parent 48891 c0eafbd55de3
child 55017 2df6ad1dbd66
permissions -rw-r--r--
removed unused/non-portable bash_output_fifo;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
44013
5cfc1c36ae97 moved recdef package to HOL/Library/Old_Recdef.thy
krauss
parents: 39302
diff changeset
     1
(*  Title:      HOL/Library/Old_Recdef.thy
10773
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
     2
    Author:     Konrad Slind and Markus Wenzel, TU Muenchen
12023
wenzelm
parents: 11533
diff changeset
     3
*)
5123
97c1d5c7b701 stepping stones;
wenzelm
parents:
diff changeset
     4
12023
wenzelm
parents: 11533
diff changeset
     5
header {* TFL: recursive function definitions *}
7701
2c8c3b7003e5 load / setup recdef package (TFL);
wenzelm
parents: 7357
diff changeset
     6
44013
5cfc1c36ae97 moved recdef package to HOL/Library/Old_Recdef.thy
krauss
parents: 39302
diff changeset
     7
theory Old_Recdef
44014
88bd7d74a2c1 moved recursion combinator to HOL/Library/Wfrec.thy -- it is so fundamental and well-known that it should survive recdef
krauss
parents: 44013
diff changeset
     8
imports Wfrec
46950
d0181abdbdac declare command keywords via theory header, including strict checking outside Pure;
wenzelm
parents: 46947
diff changeset
     9
keywords
d0181abdbdac declare command keywords via theory header, including strict checking outside Pure;
wenzelm
parents: 46947
diff changeset
    10
  "recdef" "defer_recdef" :: thy_decl and
d0181abdbdac declare command keywords via theory header, including strict checking outside Pure;
wenzelm
parents: 46947
diff changeset
    11
  "recdef_tc" :: thy_goal and
d0181abdbdac declare command keywords via theory header, including strict checking outside Pure;
wenzelm
parents: 46947
diff changeset
    12
  "permissive" "congs" "hints"
15131
c69542757a4d New theory header syntax.
nipkow
parents: 12437
diff changeset
    13
begin
10773
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    14
44013
5cfc1c36ae97 moved recdef package to HOL/Library/Old_Recdef.thy
krauss
parents: 39302
diff changeset
    15
subsection {* Lemmas for TFL *}
5cfc1c36ae97 moved recdef package to HOL/Library/Old_Recdef.thy
krauss
parents: 39302
diff changeset
    16
26748
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    17
lemma tfl_wf_induct: "ALL R. wf R -->  
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    18
       (ALL P. (ALL x. (ALL y. (y,x):R --> P y) --> P x) --> (ALL x. P x))"
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    19
apply clarify
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    20
apply (rule_tac r = R and P = P and a = x in wf_induct, assumption, blast)
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    21
done
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    22
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    23
lemma tfl_cut_apply: "ALL f R. (x,a):R --> (cut f R a)(x) = f(x)"
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    24
apply clarify
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    25
apply (rule cut_apply, assumption)
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    26
done
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    27
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    28
lemma tfl_wfrec:
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    29
     "ALL M R f. (f=wfrec R M) --> wf R --> (ALL x. f x = M (cut f R x) x)"
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    30
apply clarify
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    31
apply (erule wfrec)
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    32
done
4d51ddd6aa5c Merged theories about wellfoundedness into one: Wellfounded.thy
krauss
parents: 23742
diff changeset
    33
10773
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    34
lemma tfl_eq_True: "(x = True) --> x"
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    35
  by blast
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    36
46947
b8c7eb0c2f89 declare minor keywords via theory header;
wenzelm
parents: 46942
diff changeset
    37
lemma tfl_rev_eq_mp: "(x = y) --> y --> x"
10773
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    38
  by blast
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    39
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    40
lemma tfl_simp_thm: "(x --> y) --> (x = x') --> (x' --> y)"
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    41
  by blast
6438
e55a1869ed38 'HOL/recdef' theory data;
wenzelm
parents: 5123
diff changeset
    42
10773
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    43
lemma tfl_P_imp_P_iff_True: "P ==> P = True"
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    44
  by blast
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    45
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    46
lemma tfl_imp_trans: "(A --> B) ==> (B --> C) ==> (A --> C)"
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    47
  by blast
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    48
12023
wenzelm
parents: 11533
diff changeset
    49
lemma tfl_disj_assoc: "(a \<or> b) \<or> c == a \<or> (b \<or> c)"
10773
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    50
  by simp
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    51
12023
wenzelm
parents: 11533
diff changeset
    52
lemma tfl_disjE: "P \<or> Q ==> P --> R ==> Q --> R ==> R"
10773
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    53
  by blast
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    54
12023
wenzelm
parents: 11533
diff changeset
    55
lemma tfl_exE: "\<exists>x. P x ==> \<forall>x. P x --> Q ==> Q"
10773
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    56
  by blast
0deff0197496 renamed .sml files to .ML;
wenzelm
parents: 10653
diff changeset
    57
48891
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 46950
diff changeset
    58
ML_file "~~/src/HOL/Tools/TFL/casesplit.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 46950
diff changeset
    59
ML_file "~~/src/HOL/Tools/TFL/utils.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 46950
diff changeset
    60
ML_file "~~/src/HOL/Tools/TFL/usyntax.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 46950
diff changeset
    61
ML_file "~~/src/HOL/Tools/TFL/dcterm.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 46950
diff changeset
    62
ML_file "~~/src/HOL/Tools/TFL/thms.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 46950
diff changeset
    63
ML_file "~~/src/HOL/Tools/TFL/rules.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 46950
diff changeset
    64
ML_file "~~/src/HOL/Tools/TFL/thry.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 46950
diff changeset
    65
ML_file "~~/src/HOL/Tools/TFL/tfl.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 46950
diff changeset
    66
ML_file "~~/src/HOL/Tools/TFL/post.ML"
c0eafbd55de3 prefer ML_file over old uses;
wenzelm
parents: 46950
diff changeset
    67
ML_file "~~/src/HOL/Tools/recdef.ML"
31723
f5cafe803b55 discontinued ancient tradition to suffix certain ML module names with "_package"
haftmann
parents: 29654
diff changeset
    68
setup Recdef.setup
6438
e55a1869ed38 'HOL/recdef' theory data;
wenzelm
parents: 5123
diff changeset
    69
44014
88bd7d74a2c1 moved recursion combinator to HOL/Library/Wfrec.thy -- it is so fundamental and well-known that it should survive recdef
krauss
parents: 44013
diff changeset
    70
subsection {* Rule setup *}
32244
a99723d77ae0 moved obsolete same_fst to Recdef.thy
krauss
parents: 31723
diff changeset
    71
9855
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    72
lemmas [recdef_simp] =
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    73
  inv_image_def
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    74
  measure_def
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    75
  lex_prod_def
11284
981ea92a86dd made same_fst recdef_simp
nipkow
parents: 11165
diff changeset
    76
  same_fst_def
9855
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    77
  less_Suc_eq [THEN iffD2]
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    78
23150
073a65f0bc40 moved TFL files to canonical place;
wenzelm
parents: 22622
diff changeset
    79
lemmas [recdef_cong] =
22622
25693088396b Moving "FunDef" up in the HOL development graph, since it is independent from "Recdef" and "Datatype" now.
krauss
parents: 22399
diff changeset
    80
  if_cong let_cong image_cong INT_cong UN_cong bex_cong ball_cong imp_cong
44013
5cfc1c36ae97 moved recdef package to HOL/Library/Old_Recdef.thy
krauss
parents: 39302
diff changeset
    81
  map_cong filter_cong takeWhile_cong dropWhile_cong foldl_cong foldr_cong 
9855
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    82
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    83
lemmas [recdef_wf] =
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    84
  wf_trancl
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    85
  wf_less_than
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    86
  wf_lex_prod
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    87
  wf_inv_image
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    88
  wf_measure
44013
5cfc1c36ae97 moved recdef package to HOL/Library/Old_Recdef.thy
krauss
parents: 39302
diff changeset
    89
  wf_measures
9855
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    90
  wf_pred_nat
10653
55f33da63366 small mods.
nipkow
parents: 10212
diff changeset
    91
  wf_same_fst
9855
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    92
  wf_empty
709a295731e2 improved recdef setup;
wenzelm
parents: 8303
diff changeset
    93
6438
e55a1869ed38 'HOL/recdef' theory data;
wenzelm
parents: 5123
diff changeset
    94
end