src/HOLCF/dnat.ML
author berghofe
Wed, 20 Feb 2002 15:58:38 +0100
changeset 12907 27e6d344d724
parent 297 5ef75ff3baeb
permissions -rw-r--r--
New function change_type for changing type assignments of theorems, axioms and oracles.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     1
(*  Title: 	HOLCF/dnat.ML
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     2
    ID:         $Id$
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     3
    Author: 	Franz Regensburger
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     4
    Copyright   1993 Technische Universitaet Muenchen
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     5
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     6
Lemmas for dnat.thy 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     7
*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     8
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
     9
open Dnat;
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    10
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    11
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    12
(* The isomorphisms dnat_rep_iso and dnat_abs_iso are strict               *)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    13
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    14
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    15
val dnat_iso_strict= dnat_rep_iso RS (dnat_abs_iso RS 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    16
	(allI  RSN (2,allI RS iso_strict)));
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    17
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    18
val dnat_rews = [dnat_iso_strict RS conjunct1,
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    19
		dnat_iso_strict RS conjunct2];
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    20
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    21
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    22
(* Properties of dnat_copy                                                 *)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    23
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    24
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    25
fun prover defs thm =  prove_goalw Dnat.thy defs thm
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    26
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    27
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    28
	(cut_facts_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    29
	(asm_simp_tac (HOLCF_ss addsimps 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    30
		(dnat_rews @ [dnat_abs_iso,dnat_rep_iso])) 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    31
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    32
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    33
val dnat_copy = 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    34
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    35
	prover [dnat_copy_def] "dnat_copy[f][UU]=UU",
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    36
	prover [dnat_copy_def,dzero_def] "dnat_copy[f][dzero]= dzero",
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    37
	prover [dnat_copy_def,dsucc_def] 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    38
		"n~=UU ==> dnat_copy[f][dsucc[n]] = dsucc[f[n]]"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    39
	];
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    40
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    41
val dnat_rews =  dnat_copy @ dnat_rews; 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    42
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    43
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    44
(* Exhaustion and elimination for dnat                                     *)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    45
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    46
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    47
val Exh_dnat = prove_goalw Dnat.thy [dsucc_def,dzero_def]
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    48
	"n = UU | n = dzero | (? x . x~=UU & n = dsucc[x])"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    49
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    50
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    51
	(simp_tac HOLCF_ss  1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    52
	(rtac (dnat_rep_iso RS subst) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    53
	(res_inst_tac [("p","dnat_rep[n]")] ssumE 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    54
	(rtac disjI1 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    55
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    56
	(rtac (disjI1 RS disjI2) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    57
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    58
	(res_inst_tac [("p","x")] oneE 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    59
	(contr_tac 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    60
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    61
	(rtac (disjI2 RS disjI2) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    62
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    63
	(fast_tac HOL_cs 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    64
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    65
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    66
val dnatE = prove_goal Dnat.thy 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    67
 "[| n=UU ==> Q; n=dzero ==> Q; !!x.[|n=dsucc[x];x~=UU|]==>Q|]==>Q"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    68
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    69
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    70
	(rtac (Exh_dnat RS disjE) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    71
	(eresolve_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    72
	(etac disjE 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    73
	(eresolve_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    74
	(REPEAT (etac exE 1)),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    75
	(resolve_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    76
	(fast_tac HOL_cs 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    77
	(fast_tac HOL_cs 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    78
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    79
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    80
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    81
(* Properties of dnat_when                                                 *)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    82
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    83
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    84
fun prover defs thm =  prove_goalw Dnat.thy defs thm
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    85
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    86
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    87
	(cut_facts_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    88
	(asm_simp_tac (HOLCF_ss addsimps 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    89
		(dnat_rews @ [dnat_abs_iso,dnat_rep_iso])) 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    90
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    91
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    92
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    93
val dnat_when = [
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    94
	prover [dnat_when_def] "dnat_when[c][f][UU]=UU",
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    95
	prover [dnat_when_def,dzero_def] "dnat_when[c][f][dzero]=c",
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    96
	prover [dnat_when_def,dsucc_def] 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    97
		"n~=UU ==> dnat_when[c][f][dsucc[n]]=f[n]"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    98
	];
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
    99
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   100
val dnat_rews = dnat_when @ dnat_rews;
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   101
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   102
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   103
(* Rewrites for  discriminators and  selectors                             *)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   104
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   105
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   106
fun prover defs thm = prove_goalw Dnat.thy defs thm
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   107
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   108
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   109
	(simp_tac (HOLCF_ss addsimps dnat_rews) 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   110
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   111
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   112
val dnat_discsel = [
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   113
	prover [is_dzero_def] "is_dzero[UU]=UU",
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   114
	prover [is_dsucc_def] "is_dsucc[UU]=UU",
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   115
	prover [dpred_def] "dpred[UU]=UU"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   116
	];
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   117
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   118
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   119
fun prover defs thm = prove_goalw Dnat.thy defs thm
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   120
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   121
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   122
	(cut_facts_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   123
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   124
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   125
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   126
val dnat_discsel = [
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   127
	prover [is_dzero_def] "is_dzero[dzero]=TT",
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   128
	prover [is_dzero_def] "n~=UU ==>is_dzero[dsucc[n]]=FF",
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   129
	prover [is_dsucc_def] "is_dsucc[dzero]=FF",
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   130
	prover [is_dsucc_def] "n~=UU ==> is_dsucc[dsucc[n]]=TT",
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   131
	prover [dpred_def] "dpred[dzero]=UU",
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   132
	prover [dpred_def] "n~=UU ==> dpred[dsucc[n]]=n"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   133
	] @ dnat_discsel;
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   134
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   135
val dnat_rews = dnat_discsel @ dnat_rews;
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   136
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   137
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   138
(* Definedness and strictness                                              *)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   139
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   140
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   141
fun prover contr thm = prove_goal Dnat.thy thm
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   142
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   143
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   144
	(res_inst_tac [("P1",contr)] classical3 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   145
	(simp_tac (HOLCF_ss addsimps dnat_rews) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   146
	(dtac sym 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   147
	(asm_simp_tac HOLCF_ss  1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   148
	(simp_tac (HOLCF_ss addsimps (prems @ dnat_rews)) 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   149
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   150
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   151
val dnat_constrdef = [
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   152
	prover "is_dzero[UU] ~= UU" "dzero~=UU",
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   153
	prover "is_dsucc[UU] ~= UU" "n~=UU ==> dsucc[n]~=UU"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   154
	]; 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   155
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   156
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   157
fun prover defs thm = prove_goalw Dnat.thy defs thm
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   158
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   159
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   160
	(simp_tac (HOLCF_ss addsimps dnat_rews) 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   161
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   162
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   163
val dnat_constrdef = [
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   164
	prover [dsucc_def] "dsucc[UU]=UU"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   165
	] @ dnat_constrdef;
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   166
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   167
val dnat_rews = dnat_constrdef @ dnat_rews;
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   168
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   169
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   170
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   171
(* Distinctness wrt. << and =                                              *)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   172
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   173
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   174
val temp = prove_goal Dnat.thy  "~dzero << dsucc[n]"
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   175
 (fn prems =>
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   176
	[
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   177
	(res_inst_tac [("P1","TT << FF")] classical3 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   178
	(resolve_tac dist_less_tr 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   179
	(dres_inst_tac [("fo5","is_dzero")] monofun_cfun_arg 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   180
	(etac box_less 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   181
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   182
	(res_inst_tac [("Q","n=UU")] classical2 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   183
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   184
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1)
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   185
	]);
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   186
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   187
val dnat_dist_less = [temp];
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   188
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   189
val temp = prove_goal Dnat.thy  "n~=UU ==> ~dsucc[n] << dzero"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   190
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   191
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   192
	(cut_facts_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   193
	(res_inst_tac [("P1","TT << FF")] classical3 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   194
	(resolve_tac dist_less_tr 1),
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   195
	(dres_inst_tac [("fo5","is_dsucc")] monofun_cfun_arg 1),
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   196
	(etac box_less 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   197
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   198
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   199
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   200
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   201
val dnat_dist_less = temp::dnat_dist_less;
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   202
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   203
val temp = prove_goal Dnat.thy   "dzero ~= dsucc[n]"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   204
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   205
	[
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   206
	(res_inst_tac [("Q","n=UU")] classical2 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   207
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   208
	(res_inst_tac [("P1","TT = FF")] classical3 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   209
	(resolve_tac dist_eq_tr 1),
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   210
	(dres_inst_tac [("f","is_dzero")] cfun_arg_cong 1),
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   211
	(etac box_equals 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   212
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   213
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   214
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   215
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   216
val dnat_dist_eq = [temp, temp RS not_sym];
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   217
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   218
val dnat_rews = dnat_dist_less @ dnat_dist_eq @ dnat_rews;
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   219
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   220
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   221
(* Invertibility                                                           *)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   222
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   223
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   224
val dnat_invert = 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   225
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   226
prove_goal Dnat.thy 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   227
"[|x1~=UU; y1~=UU; dsucc[x1] << dsucc[y1] |] ==> x1<< y1"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   228
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   229
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   230
	(cut_facts_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   231
	(dres_inst_tac [("fo5","dnat_when[c][LAM x.x]")] monofun_cfun_arg 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   232
	(etac box_less 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   233
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   234
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   235
	])
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   236
	];
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   237
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   238
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   239
(* Injectivity                                                             *)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   240
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   241
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   242
val dnat_inject = 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   243
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   244
prove_goal Dnat.thy 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   245
"[|x1~=UU; y1~=UU; dsucc[x1] = dsucc[y1] |] ==> x1= y1"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   246
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   247
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   248
	(cut_facts_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   249
	(dres_inst_tac [("f","dnat_when[c][LAM x.x]")] cfun_arg_cong 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   250
	(etac box_equals 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   251
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   252
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   253
	])
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   254
	];
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   255
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   256
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   257
(* definedness for  discriminators and  selectors                          *)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   258
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   259
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   260
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   261
fun prover thm = prove_goal Dnat.thy thm
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   262
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   263
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   264
	(cut_facts_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   265
	(rtac dnatE 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   266
	(contr_tac 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   267
	(REPEAT (asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1))
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   268
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   269
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   270
val dnat_discsel_def = 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   271
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   272
	prover  "n~=UU ==> is_dzero[n]~=UU",
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   273
	prover  "n~=UU ==> is_dsucc[n]~=UU"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   274
	];
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   275
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   276
val dnat_rews = dnat_discsel_def @ dnat_rews;
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   277
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   278
 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   279
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   280
(* Properties dnat_take                                                    *)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   281
(* ------------------------------------------------------------------------*)
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   282
val temp = prove_goalw Dnat.thy [dnat_take_def] "dnat_take(n)[UU]=UU"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   283
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   284
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   285
	(res_inst_tac [("n","n")] natE 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   286
	(asm_simp_tac iterate_ss 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   287
	(asm_simp_tac iterate_ss 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   288
	(simp_tac (HOLCF_ss addsimps dnat_rews) 1)
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   289
	]);
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   290
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   291
val dnat_take = [temp];
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   292
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   293
val temp = prove_goalw Dnat.thy [dnat_take_def] "dnat_take(0)[xs]=UU"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   294
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   295
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   296
	(asm_simp_tac iterate_ss 1)
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   297
	]);
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   298
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   299
val dnat_take = temp::dnat_take;
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   300
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   301
val temp = prove_goalw Dnat.thy [dnat_take_def]
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   302
	"dnat_take(Suc(n))[dzero]=dzero"
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   303
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   304
	[
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   305
	(asm_simp_tac iterate_ss 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   306
	(simp_tac (HOLCF_ss addsimps dnat_rews) 1)
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   307
	]);
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   308
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   309
val dnat_take = temp::dnat_take;
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   310
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   311
val temp = prove_goalw Dnat.thy [dnat_take_def]
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   312
  "dnat_take(Suc(n))[dsucc[xs]]=dsucc[dnat_take(n)[xs]]"
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   313
 (fn prems =>
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   314
	[
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   315
	(res_inst_tac [("Q","xs=UU")] classical2 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   316
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   317
	(asm_simp_tac iterate_ss 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   318
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   319
	(res_inst_tac [("n","n")] natE 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   320
	(asm_simp_tac iterate_ss 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   321
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   322
	(asm_simp_tac iterate_ss 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   323
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   324
	(asm_simp_tac iterate_ss 1),
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   325
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   326
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   327
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   328
val dnat_take = temp::dnat_take;
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   329
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   330
val dnat_rews = dnat_take @ dnat_rews;
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   331
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   332
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   333
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   334
(* take lemma for dnats                                                  *)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   335
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   336
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   337
fun prover reach defs thm  = prove_goalw Dnat.thy defs thm
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   338
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   339
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   340
	(res_inst_tac [("t","s1")] (reach RS subst) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   341
	(res_inst_tac [("t","s2")] (reach RS subst) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   342
	(rtac (fix_def2 RS ssubst) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   343
	(rtac (contlub_cfun_fun RS ssubst) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   344
	(rtac is_chain_iterate 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   345
	(rtac (contlub_cfun_fun RS ssubst) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   346
	(rtac is_chain_iterate 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   347
	(rtac lub_equal 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   348
	(rtac (is_chain_iterate RS ch2ch_fappL) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   349
	(rtac (is_chain_iterate RS ch2ch_fappL) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   350
	(rtac allI 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   351
	(resolve_tac prems 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   352
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   353
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   354
val dnat_take_lemma = prover dnat_reach  [dnat_take_def]
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   355
	"(!!n.dnat_take(n)[s1]=dnat_take(n)[s2]) ==> s1=s2";
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   356
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   357
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   358
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   359
(* Co -induction for dnats                                                 *)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   360
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   361
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   362
val dnat_coind_lemma = prove_goalw Dnat.thy [dnat_bisim_def] 
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   363
"dnat_bisim(R) ==> ! p q.R(p,q) --> dnat_take(n)[p]=dnat_take(n)[q]"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   364
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   365
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   366
	(cut_facts_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   367
	(nat_ind_tac "n" 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   368
	(simp_tac (HOLCF_ss addsimps dnat_take) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   369
	(strip_tac 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   370
	((etac allE 1) THEN (etac allE 1) THEN (etac (mp RS disjE) 1)),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   371
	(atac 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   372
	(asm_simp_tac (HOLCF_ss addsimps dnat_take) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   373
	(etac disjE 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   374
	(asm_simp_tac (HOLCF_ss addsimps dnat_take) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   375
	(etac exE 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   376
	(etac exE 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   377
	(asm_simp_tac (HOLCF_ss addsimps dnat_take) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   378
	(REPEAT (etac conjE 1)),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   379
	(rtac cfun_arg_cong 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   380
	(fast_tac HOL_cs 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   381
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   382
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   383
val dnat_coind = prove_goal Dnat.thy "[|dnat_bisim(R);R(p,q)|] ==> p = q"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   384
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   385
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   386
	(rtac dnat_take_lemma 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   387
	(rtac (dnat_coind_lemma RS spec RS spec RS mp) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   388
	(resolve_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   389
	(resolve_tac prems 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   390
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   391
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   392
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   393
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   394
(* structural induction for admissible predicates                          *)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   395
(* ------------------------------------------------------------------------*)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   396
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   397
(* not needed any longer
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   398
val dnat_ind = prove_goal Dnat.thy
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   399
"[| adm(P);\
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   400
\   P(UU);\
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   401
\   P(dzero);\
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   402
\   !! s1.[|s1~=UU ; P(s1)|] ==> P(dsucc[s1])|] ==> P(s)"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   403
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   404
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   405
	(rtac (dnat_reach RS subst) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   406
	(res_inst_tac [("x","s")] spec 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   407
	(rtac fix_ind 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   408
	(rtac adm_all2 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   409
	(rtac adm_subst 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   410
	(contX_tacR 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   411
	(resolve_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   412
	(simp_tac HOLCF_ss 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   413
	(resolve_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   414
	(strip_tac 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   415
	(res_inst_tac [("n","xa")] dnatE 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   416
	(asm_simp_tac (HOLCF_ss addsimps dnat_copy) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   417
	(resolve_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   418
	(asm_simp_tac (HOLCF_ss addsimps dnat_copy) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   419
	(resolve_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   420
	(asm_simp_tac (HOLCF_ss addsimps dnat_copy) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   421
	(res_inst_tac [("Q","x[xb]=UU")] classical2 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   422
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   423
	(resolve_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   424
	(eresolve_tac prems 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   425
	(etac spec 1)
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   426
	]);
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   427
*)
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   428
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   429
val dnat_finite_ind = prove_goal Dnat.thy
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   430
"[|P(UU);P(dzero);\
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   431
\  !! s1.[|s1~=UU;P(s1)|] ==> P(dsucc[s1])\
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   432
\  |] ==> !s.P(dnat_take(n)[s])"
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   433
 (fn prems =>
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   434
	[
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   435
	(nat_ind_tac "n" 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   436
	(simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   437
	(resolve_tac prems 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   438
	(rtac allI 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   439
	(res_inst_tac [("n","s")] dnatE 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   440
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   441
	(resolve_tac prems 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   442
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   443
	(resolve_tac prems 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   444
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   445
	(res_inst_tac [("Q","dnat_take(n1)[x]=UU")] classical2 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   446
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   447
	(resolve_tac prems 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   448
	(resolve_tac prems 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   449
	(atac 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   450
	(etac spec 1)
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   451
	]);
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   452
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   453
val dnat_all_finite_lemma1 = prove_goal Dnat.thy
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   454
"!s.dnat_take(n)[s]=UU |dnat_take(n)[s]=s"
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   455
 (fn prems =>
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   456
	[
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   457
	(nat_ind_tac "n" 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   458
	(simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   459
	(rtac allI 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   460
	(res_inst_tac [("n","s")] dnatE 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   461
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   462
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   463
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   464
	(eres_inst_tac [("x","x")] allE 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   465
	(etac disjE 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   466
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   467
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1)
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   468
	]);
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   469
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   470
val dnat_all_finite_lemma2 = prove_goal Dnat.thy "? n.dnat_take(n)[s]=s"
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   471
 (fn prems =>
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   472
	[
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   473
	(res_inst_tac [("Q","s=UU")] classical2 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   474
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   475
	(subgoal_tac "(!n.dnat_take(n)[s]=UU) |(? n.dnat_take(n)[s]=s)" 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   476
	(etac disjE 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   477
	(eres_inst_tac [("P","s=UU")] notE 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   478
	(rtac dnat_take_lemma 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   479
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   480
	(atac 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   481
	(subgoal_tac "!n.!s.dnat_take(n)[s]=UU |dnat_take(n)[s]=s" 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   482
	(fast_tac HOL_cs 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   483
	(rtac allI 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   484
	(rtac dnat_all_finite_lemma1 1)
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   485
	]);
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   486
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   487
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   488
val dnat_ind = prove_goal Dnat.thy
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   489
"[|P(UU);P(dzero);\
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   490
\  !! s1.[|s1~=UU;P(s1)|] ==> P(dsucc[s1])\
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   491
\  |] ==> P(s)"
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   492
 (fn prems =>
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   493
	[
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   494
	(rtac (dnat_all_finite_lemma2 RS exE) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   495
	(etac subst 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   496
	(rtac (dnat_finite_ind RS spec) 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   497
	(REPEAT (resolve_tac prems 1)),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   498
	(REPEAT (atac 1))
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   499
	]);
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   500
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   501
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   502
val dnat_flat = prove_goalw Dnat.thy [flat_def] "flat(dzero)"
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   503
 (fn prems =>
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   504
	[
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   505
	(rtac allI 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   506
	(res_inst_tac [("s","x")] dnat_ind 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   507
	(fast_tac HOL_cs 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   508
	(rtac allI 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   509
	(res_inst_tac [("n","y")] dnatE 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   510
	(fast_tac (HOL_cs addSIs [UU_I]) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   511
	(asm_simp_tac HOLCF_ss 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   512
	(asm_simp_tac (HOLCF_ss addsimps dnat_dist_less) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   513
	(rtac allI 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   514
	(res_inst_tac [("n","y")] dnatE 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   515
	(fast_tac (HOL_cs addSIs [UU_I]) 1),
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   516
	(asm_simp_tac (HOLCF_ss addsimps dnat_dist_less) 1),
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   517
	(asm_simp_tac (HOLCF_ss addsimps dnat_rews) 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   518
	(strip_tac 1),
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   519
	(subgoal_tac "s1<<xa" 1),
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   520
	(etac allE 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   521
	(dtac mp 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   522
	(atac 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   523
	(etac disjE 1),
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   524
	(contr_tac 1),
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   525
	(asm_simp_tac HOLCF_ss 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   526
	(resolve_tac  dnat_invert 1),
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   527
	(REPEAT (atac 1))
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   528
	]);
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   529
297
5ef75ff3baeb Franz fragen
nipkow
parents: 243
diff changeset
   530
243
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   531
c22b85994e17 Franz Regensburger's Higher-Order Logic of Computable Functions embedding LCF
nipkow
parents:
diff changeset
   532