src/HOL/AxClasses/Lattice/CLattice.ML
author wenzelm
Mon, 15 Jan 1996 15:49:21 +0100
changeset 1440 de6f18da81bb
child 1465 5d7a7e439cec
permissions -rw-r--r--
added this stuff;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1440
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
     1
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
     2
open CLattice;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
     3
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
     4
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
     5
(** basic properties of "Inf" and "Sup" **)
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
     6
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
     7
(* unique existence *)
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
     8
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
     9
goalw thy [Inf_def] "is_Inf A (Inf A)";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    10
  br (ex_Inf RS spec RS selectI1) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    11
qed "Inf_is_Inf";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    12
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    13
goal thy "is_Inf A inf --> Inf A = inf";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    14
  br impI 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    15
  br (is_Inf_uniq RS mp) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    16
  br conjI 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    17
  br Inf_is_Inf 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    18
  ba 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    19
qed "Inf_uniq";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    20
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    21
goalw thy [Ex1_def] "ALL A. EX! inf::'a::clattice. is_Inf A inf";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    22
  by (safe_tac HOL_cs);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    23
  by (step_tac HOL_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    24
  by (step_tac HOL_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    25
  br Inf_is_Inf 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    26
  br (Inf_uniq RS mp RS sym) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    27
  ba 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    28
qed "ex1_Inf";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    29
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    30
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    31
goalw thy [Sup_def] "is_Sup A (Sup A)";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    32
  br (ex_Sup RS spec RS selectI1) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    33
qed "Sup_is_Sup";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    34
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    35
goal thy "is_Sup A sup --> Sup A = sup";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    36
  br impI 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    37
  br (is_Sup_uniq RS mp) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    38
  br conjI 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    39
  br Sup_is_Sup 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    40
  ba 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    41
qed "Sup_uniq";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    42
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    43
goalw thy [Ex1_def] "ALL A. EX! sup::'a::clattice. is_Sup A sup";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    44
  by (safe_tac HOL_cs);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    45
  by (step_tac HOL_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    46
  by (step_tac HOL_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    47
  br Sup_is_Sup 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    48
  br (Sup_uniq RS mp RS sym) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    49
  ba 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    50
qed "ex1_Sup";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    51
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    52
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    53
(* "Inf" yields g.l.bs, "Sup" yields l.u.bs. --- in pieces *)
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    54
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    55
val prems = goalw thy [Inf_def] "x:A ==> Inf A [= x";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    56
  by (cut_facts_tac prems 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    57
  br selectI2 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    58
  br Inf_is_Inf 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    59
  by (rewrite_goals_tac [is_Inf_def]);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    60
  by (fast_tac set_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    61
qed "Inf_lb";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    62
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    63
val [prem] = goalw thy [Inf_def] "(!!x. x:A ==> z [= x) ==> z [= Inf A";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    64
  br selectI2 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    65
  br Inf_is_Inf 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    66
  by (rewrite_goals_tac [is_Inf_def]);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    67
  by (step_tac HOL_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    68
  by (step_tac HOL_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    69
  be mp 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    70
  br ballI 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    71
  be prem 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    72
qed "Inf_ub_lbs";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    73
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    74
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    75
val prems = goalw thy [Sup_def] "x:A ==> x [= Sup A";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    76
  by (cut_facts_tac prems 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    77
  br selectI2 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    78
  br Sup_is_Sup 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    79
  by (rewrite_goals_tac [is_Sup_def]);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    80
  by (fast_tac set_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    81
qed "Sup_ub";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    82
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    83
val [prem] = goalw thy [Sup_def] "(!!x. x:A ==> x [= z) ==> Sup A [= z";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    84
  br selectI2 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    85
  br Sup_is_Sup 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    86
  by (rewrite_goals_tac [is_Sup_def]);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    87
  by (step_tac HOL_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    88
  by (step_tac HOL_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    89
  be mp 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    90
  br ballI 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    91
  be prem 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    92
qed "Sup_lb_ubs";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    93
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    94
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    95
(** minorized Infs / majorized Sups **)
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    96
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    97
goal thy "(x [= Inf A) = (ALL y:A. x [= y)";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    98
  br iffI 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
    99
  (*==>*)
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   100
    br ballI 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   101
    br (le_trans RS mp) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   102
    be conjI 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   103
    be Inf_lb 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   104
  (*<==*)
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   105
    br Inf_ub_lbs 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   106
    by (fast_tac set_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   107
qed "le_Inf_eq";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   108
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   109
goal thy "(Sup A [= x) = (ALL y:A. y [= x)";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   110
  br iffI 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   111
  (*==>*)
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   112
    br ballI 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   113
    br (le_trans RS mp) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   114
    br conjI 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   115
    be Sup_ub 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   116
    ba 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   117
  (*<==*)
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   118
    br Sup_lb_ubs 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   119
    by (fast_tac set_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   120
qed "ge_Sup_eq";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   121
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   122
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   123
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   124
(** Subsets and limits **)
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   125
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   126
goal thy "A <= B --> Inf B [= Inf A";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   127
  br impI 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   128
  by (stac le_Inf_eq 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   129
  by (rewrite_goals_tac [Ball_def]);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   130
  by (safe_tac set_cs);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   131
  bd subsetD 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   132
  ba 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   133
  be Inf_lb 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   134
qed "Inf_subset_antimon";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   135
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   136
goal thy "A <= B --> Sup A [= Sup B";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   137
  br impI 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   138
  by (stac ge_Sup_eq 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   139
  by (rewrite_goals_tac [Ball_def]);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   140
  by (safe_tac set_cs);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   141
  bd subsetD 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   142
  ba 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   143
  be Sup_ub 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   144
qed "Sup_subset_mon";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   145
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   146
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   147
(** singleton / empty limits **)
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   148
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   149
goal thy "Inf {x} = x";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   150
  br (Inf_uniq RS mp) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   151
  by (rewrite_goals_tac [is_Inf_def]);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   152
  by (safe_tac set_cs);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   153
  br le_refl 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   154
  by (fast_tac set_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   155
qed "sing_Inf_eq";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   156
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   157
goal thy "Sup {x} = x";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   158
  br (Sup_uniq RS mp) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   159
  by (rewrite_goals_tac [is_Sup_def]);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   160
  by (safe_tac set_cs);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   161
  br le_refl 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   162
  by (fast_tac set_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   163
qed "sing_Sup_eq";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   164
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   165
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   166
goal thy "Inf {} = Sup {x. True}";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   167
  br (Inf_uniq RS mp) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   168
  by (rewrite_goals_tac [is_Inf_def]);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   169
  by (safe_tac set_cs);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   170
  br (sing_Sup_eq RS subst) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   171
  back();
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   172
  br (Sup_subset_mon RS mp) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   173
  by (fast_tac set_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   174
qed "empty_Inf_eq";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   175
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   176
goal thy "Sup {} = Inf {x. True}";
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   177
  br (Sup_uniq RS mp) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   178
  by (rewrite_goals_tac [is_Sup_def]);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   179
  by (safe_tac set_cs);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   180
  br (sing_Inf_eq RS subst) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   181
  br (Inf_subset_antimon RS mp) 1;
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   182
  by (fast_tac set_cs 1);
de6f18da81bb added this stuff;
wenzelm
parents:
diff changeset
   183
qed "empty_Sup_eq";