Quot/QuotMain.thy
author Christian Urban <urbanc@in.tum.de>
Thu, 17 Dec 2009 14:58:33 +0100
changeset 758 3104d62e7a16
parent 752 17d06b5ec197
child 759 119f7d6a3556
permissions -rw-r--r--
moved the QuotMain code into two ML-files
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     1
theory QuotMain
648
830b58c2fa94 decoupled QuotProd from QuotMain and also started new cleaning strategy
Christian Urban <urbanc@in.tum.de>
parents: 643
diff changeset
     2
imports QuotScript Prove
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     3
uses ("quotient_info.ML")
725
0d98a4c7f8dc renamed quotient.ML to quotient_typ.ML
Christian Urban <urbanc@in.tum.de>
parents: 720
diff changeset
     4
     ("quotient_typ.ML")
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     5
     ("quotient_def.ML")
758
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
     6
     ("quotient_term.ML")
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
     7
     ("quotient_tacs.ML")
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     8
begin
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
     9
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    10
locale QUOT_TYPE =
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    11
  fixes R :: "'a \<Rightarrow> 'a \<Rightarrow> bool"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    12
  and   Abs :: "('a \<Rightarrow> bool) \<Rightarrow> 'b"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    13
  and   Rep :: "'b \<Rightarrow> ('a \<Rightarrow> bool)"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    14
  assumes equivp: "equivp R"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    15
  and     rep_prop: "\<And>y. \<exists>x. Rep y = R x"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    16
  and     rep_inverse: "\<And>x. Abs (Rep x) = x"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    17
  and     abs_inverse: "\<And>x. (Rep (Abs (R x))) = (R x)"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    18
  and     rep_inject: "\<And>x y. (Rep x = Rep y) = (x = y)"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    19
begin
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    20
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    21
definition
719
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    22
  abs::"'a \<Rightarrow> 'b"
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    23
where
719
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    24
  "abs x \<equiv> Abs (R x)"
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    25
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    26
definition
719
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    27
  rep::"'b \<Rightarrow> 'a"
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    28
where
719
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    29
  "rep a = Eps (Rep a)"
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    30
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    31
lemma lem9:
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    32
  shows "R (Eps (R x)) = R x"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    33
proof -
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    34
  have a: "R x x" using equivp by (simp add: equivp_reflp_symp_transp reflp_def)
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    35
  then have "R x (Eps (R x))" by (rule someI)
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    36
  then show "R (Eps (R x)) = R x"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    37
    using equivp unfolding equivp_def by simp
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    38
qed
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    39
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    40
theorem thm10:
719
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    41
  shows "abs (rep a) \<equiv> a"
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    42
  apply  (rule eq_reflection)
719
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    43
  unfolding abs_def rep_def
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    44
proof -
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    45
  from rep_prop
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    46
  obtain x where eq: "Rep a = R x" by auto
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    47
  have "Abs (R (Eps (Rep a))) = Abs (R (Eps (R x)))" using eq by simp
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    48
  also have "\<dots> = Abs (R x)" using lem9 by simp
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    49
  also have "\<dots> = Abs (Rep a)" using eq by simp
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    50
  also have "\<dots> = a" using rep_inverse by simp
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    51
  finally
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    52
  show "Abs (R (Eps (Rep a))) = a" by simp
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    53
qed
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    54
719
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    55
lemma rep_refl:
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    56
  shows "R (rep a) (rep a)"
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    57
unfolding rep_def
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    58
by (simp add: equivp[simplified equivp_def])
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    59
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    60
lemma lem7:
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    61
  shows "(R x = R y) = (Abs (R x) = Abs (R y))"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    62
apply(rule iffI)
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    63
apply(simp)
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    64
apply(drule rep_inject[THEN iffD2])
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    65
apply(simp add: abs_inverse)
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    66
done
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    67
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    68
theorem thm11:
719
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    69
  shows "R r r' = (abs r = abs r')"
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    70
unfolding abs_def
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    71
by (simp only: equivp[simplified equivp_def] lem7)
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    72
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    73
719
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    74
lemma rep_abs_rsp:
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    75
  shows "R f (rep (abs g)) = R f g"
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    76
  and   "R (rep (abs g)) f = R g f"
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    77
by (simp_all add: thm10 thm11)
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    78
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    79
lemma Quotient:
719
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    80
  "Quotient R abs rep"
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    81
apply(unfold Quotient_def)
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    82
apply(simp add: thm10)
719
a9e55e1ef64c Renaming
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 715
diff changeset
    83
apply(simp add: rep_refl)
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    84
apply(subst thm11[symmetric])
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    85
apply(simp add: equivp[simplified equivp_def])
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    86
done
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    87
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    88
end
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    89
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    90
section {* type definition for the quotient type *}
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    91
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    92
(* the auxiliary data for the quotient types *)
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    93
use "quotient_info.ML"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    94
699
aa157e957655 added maps-printout and tuned some comments
Christian Urban <urbanc@in.tum.de>
parents: 697
diff changeset
    95
ML {* print_mapsinfo @{context} *}
aa157e957655 added maps-printout and tuned some comments
Christian Urban <urbanc@in.tum.de>
parents: 697
diff changeset
    96
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
    97
declare [[map "fun" = (fun_map, fun_rel)]]
615
386a6b1a5203 the lift_tac produces a warning message if one of the three automatic proofs fails
Christian Urban <urbanc@in.tum.de>
parents: 614
diff changeset
    98
648
830b58c2fa94 decoupled QuotProd from QuotMain and also started new cleaning strategy
Christian Urban <urbanc@in.tum.de>
parents: 643
diff changeset
    99
lemmas [quot_thm] = fun_quotient 
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   100
648
830b58c2fa94 decoupled QuotProd from QuotMain and also started new cleaning strategy
Christian Urban <urbanc@in.tum.de>
parents: 643
diff changeset
   101
lemmas [quot_respect] = quot_rel_rsp
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   102
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   103
(* fun_map is not here since equivp is not true *)
648
830b58c2fa94 decoupled QuotProd from QuotMain and also started new cleaning strategy
Christian Urban <urbanc@in.tum.de>
parents: 643
diff changeset
   104
lemmas [quot_equiv] = identity_equivp
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   105
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   106
(* definition of the quotient types *)
725
0d98a4c7f8dc renamed quotient.ML to quotient_typ.ML
Christian Urban <urbanc@in.tum.de>
parents: 720
diff changeset
   107
use "quotient_typ.ML"
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   108
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   109
(* lifting of constants *)
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   110
use "quotient_def.ML"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   111
758
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   112
(* the translation functions *)
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   113
use "quotient_term.ML" 
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   114
758
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   115
(* tactics *)
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   116
lemma eq_imp_rel:  
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   117
  "equivp R ==> a = b --> R a b" 
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   118
by (simp add: equivp_reflp)
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   119
758
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   120
definition
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   121
  "QUOT_TRUE x \<equiv> True"
605
120e479ed367 first attempt to deal with Babs in regularise and cleaning (not yet working)
Christian Urban <urbanc@in.tum.de>
parents: 602
diff changeset
   122
758
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   123
lemma quot_true_dests:
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   124
  shows QT_all: "QUOT_TRUE (All P) \<Longrightarrow> QUOT_TRUE P"
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   125
  and   QT_ex:  "QUOT_TRUE (Ex P) \<Longrightarrow> QUOT_TRUE P"
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   126
  and   QT_lam: "QUOT_TRUE (\<lambda>x. P x) \<Longrightarrow> (\<And>x. QUOT_TRUE  (P x))"
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   127
  and   QT_ext: "(\<And>x. QUOT_TRUE (a x) \<Longrightarrow> f x = g x) \<Longrightarrow> (QUOT_TRUE a \<Longrightarrow> f = g)"
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   128
by (simp_all add: QUOT_TRUE_def ext)
751
670131bcba4a some commenting
Christian Urban <urbanc@in.tum.de>
parents: 750
diff changeset
   129
758
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   130
lemma QUOT_TRUE_imp: "QUOT_TRUE a \<equiv> QUOT_TRUE b"
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   131
by (simp add: QUOT_TRUE_def)
751
670131bcba4a some commenting
Christian Urban <urbanc@in.tum.de>
parents: 750
diff changeset
   132
758
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   133
lemma regularize_to_injection: "(QUOT_TRUE l \<Longrightarrow> y) \<Longrightarrow> (l = r) \<longrightarrow> y"
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   134
  by(auto simp add: QUOT_TRUE_def)
751
670131bcba4a some commenting
Christian Urban <urbanc@in.tum.de>
parents: 750
diff changeset
   135
758
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   136
use "quotient_tacs.ML"
751
670131bcba4a some commenting
Christian Urban <urbanc@in.tum.de>
parents: 750
diff changeset
   137
614
51a4208162ed added a thm list for ids
Christian Urban <urbanc@in.tum.de>
parents: 613
diff changeset
   138
section {* Atomize Infrastructure *}
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   139
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   140
lemma atomize_eqv[atomize]:
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   141
  shows "(Trueprop A \<equiv> Trueprop B) \<equiv> (A \<equiv> B)"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   142
proof
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   143
  assume "A \<equiv> B"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   144
  then show "Trueprop A \<equiv> Trueprop B" by unfold
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   145
next
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   146
  assume *: "Trueprop A \<equiv> Trueprop B"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   147
  have "A = B"
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   148
  proof (cases A)
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   149
    case True
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   150
    have "A" by fact
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   151
    then show "A = B" using * by simp
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   152
  next
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   153
    case False
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   154
    have "\<not>A" by fact
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   155
    then show "A = B" using * by auto
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   156
  qed
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   157
  then show "A \<equiv> B" by (rule eq_reflection)
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   158
qed
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   159
614
51a4208162ed added a thm list for ids
Christian Urban <urbanc@in.tum.de>
parents: 613
diff changeset
   160
section {* Infrastructure about id *}
51a4208162ed added a thm list for ids
Christian Urban <urbanc@in.tum.de>
parents: 613
diff changeset
   161
668
ef5b941f00e2 Code cleaning.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 665
diff changeset
   162
lemmas [id_simps] =
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   163
  fun_map_id[THEN eq_reflection]
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   164
  id_apply[THEN eq_reflection]
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   165
  id_def[THEN eq_reflection,symmetric]
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   166
689
Christian Urban <urbanc@in.tum.de>
parents: 688
diff changeset
   167
section {* Methods / Interface *}
Christian Urban <urbanc@in.tum.de>
parents: 688
diff changeset
   168
632
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   169
ML {*
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   170
fun mk_method1 tac thm ctxt =
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   171
  SIMPLE_METHOD (HEADGOAL (tac ctxt thm)) 
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   172
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   173
fun mk_method2 tac ctxt =
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   174
  SIMPLE_METHOD (HEADGOAL (tac ctxt)) 
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   175
*}
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   176
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   177
method_setup lifting =
758
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   178
  {* Attrib.thm >> (mk_method1 Quotient_Tacs.lift_tac) *}
632
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   179
  {* Lifting of theorems to quotient types. *}
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   180
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   181
method_setup lifting_setup =
758
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   182
  {* Attrib.thm >> (mk_method1 Quotient_Tacs.procedure_tac) *}
632
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   183
  {* Sets up the three goals for the lifting procedure. *}
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   184
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   185
method_setup regularize =
758
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   186
  {* Scan.succeed (mk_method2 Quotient_Tacs.regularize_tac)  *}
632
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   187
  {* Proves automatically the regularization goals from the lifting procedure. *}
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   188
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   189
method_setup injection =
758
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   190
  {* Scan.succeed (mk_method2 Quotient_Tacs.all_inj_repabs_tac) *}
632
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   191
  {* Proves automatically the rep/abs injection goals from the lifting procedure. *}
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   192
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   193
method_setup cleaning =
758
3104d62e7a16 moved the QuotMain code into two ML-files
Christian Urban <urbanc@in.tum.de>
parents: 752
diff changeset
   194
  {* Scan.succeed (mk_method2 Quotient_Tacs.clean_tac) *}
632
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   195
  {* Proves automatically the cleaning goals from the lifting procedure. *}
d23416464f62 added methods for the lifting_tac and the other tacs
Christian Urban <urbanc@in.tum.de>
parents: 624
diff changeset
   196
597
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   197
end
8a1c8dc72b5c directory re-arrangement
Christian Urban <urbanc@in.tum.de>
parents:
diff changeset
   198