QuotTest.thy
author Cezary Kaliszyk <kaliszyk@in.tum.de>
Wed, 04 Nov 2009 16:10:39 +0100
changeset 284 78bc4d9d7975
parent 254 77ff9624cfd6
child 285 8ebdef196fd5
permissions -rw-r--r--
Two new tests for get_fun. Second one fails.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     1
theory QuotTest
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     2
imports QuotMain
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     3
begin
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     4
254
77ff9624cfd6 fixed the problem with types in map
Christian Urban <urbanc@in.tum.de>
parents: 230
diff changeset
     5
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
section {* various tests for quotient types*}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     7
datatype trm =
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     8
  var  "nat"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     9
| app  "trm" "trm"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
| lam  "nat" "trm"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    11
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
axiomatization
177
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
    13
  RR :: "trm \<Rightarrow> trm \<Rightarrow> bool"
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
where
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
  r_eq: "EQUIV RR"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
185
929bc55efff7 added code for declaring map-functions
Christian Urban <urbanc@in.tum.de>
parents: 180
diff changeset
    17
print_quotients
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    19
quotient qtrm = trm / "RR"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    20
  apply(rule r_eq)
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    21
  done
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    22
185
929bc55efff7 added code for declaring map-functions
Christian Urban <urbanc@in.tum.de>
parents: 180
diff changeset
    23
print_quotients
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    24
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
typ qtrm
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
term Rep_qtrm
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
term REP_qtrm
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
term Abs_qtrm
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    29
term ABS_qtrm
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    30
thm QUOT_TYPE_qtrm
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    31
thm QUOTIENT_qtrm
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    32
thm REP_qtrm_def
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    34
(* Test interpretation *)
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    35
thm QUOT_TYPE_I_qtrm.thm11
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
thm QUOT_TYPE.thm11
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    38
print_theorems
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    39
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
thm Rep_qtrm
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    42
text {* another test *}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    43
datatype 'a trm' =
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    44
  var'  "'a"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    45
| app'  "'a trm'" "'a trm'"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    46
| lam'  "'a" "'a trm'"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    47
177
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
    48
consts R' :: "'a trm' \<Rightarrow> 'a trm' \<Rightarrow> bool"
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    49
axioms r_eq': "EQUIV R'"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    50
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    51
quotient qtrm' = "'a trm'" / "R'"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    52
  apply(rule r_eq')
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    53
  done
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    54
185
929bc55efff7 added code for declaring map-functions
Christian Urban <urbanc@in.tum.de>
parents: 180
diff changeset
    55
print_quotients
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    56
print_theorems
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    57
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    58
term ABS_qtrm'
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    59
term REP_qtrm'
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    60
thm QUOT_TYPE_qtrm'
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    61
thm QUOTIENT_qtrm'
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    62
thm Rep_qtrm'
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    63
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    64
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    65
text {* a test with lists of terms *}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    66
datatype t =
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    67
  vr "string"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    68
| ap "t list"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    69
| lm "string" "t"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    70
177
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
    71
consts Rt :: "t \<Rightarrow> t \<Rightarrow> bool"
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    72
axioms t_eq: "EQUIV Rt"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    73
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    74
quotient qt = "t" / "Rt"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    75
  by (rule t_eq)
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    76
185
929bc55efff7 added code for declaring map-functions
Christian Urban <urbanc@in.tum.de>
parents: 180
diff changeset
    77
print_quotients
929bc55efff7 added code for declaring map-functions
Christian Urban <urbanc@in.tum.de>
parents: 180
diff changeset
    78
929bc55efff7 added code for declaring map-functions
Christian Urban <urbanc@in.tum.de>
parents: 180
diff changeset
    79
ML {*
929bc55efff7 added code for declaring map-functions
Christian Urban <urbanc@in.tum.de>
parents: 180
diff changeset
    80
Toplevel.context_of;
929bc55efff7 added code for declaring map-functions
Christian Urban <urbanc@in.tum.de>
parents: 180
diff changeset
    81
Toplevel.keep
929bc55efff7 added code for declaring map-functions
Christian Urban <urbanc@in.tum.de>
parents: 180
diff changeset
    82
*}
929bc55efff7 added code for declaring map-functions
Christian Urban <urbanc@in.tum.de>
parents: 180
diff changeset
    83
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    84
ML {*
230
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
    85
  get_fun repF [(@{typ qt}, @{typ qt})] @{context} @{typ "((((qt \<Rightarrow> qt) \<Rightarrow> qt) \<Rightarrow> qt) list) * nat"}
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    86
  |> fst
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    87
  |> Syntax.string_of_term @{context}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    88
  |> writeln
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    89
*}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    90
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    91
ML {*
230
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
    92
  get_fun absF [(@{typ qt}, @{typ t})] @{context} @{typ "qt * nat"}
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    93
  |> fst
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    94
  |> Syntax.string_of_term @{context}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    95
  |> writeln
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    96
*}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    97
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    98
ML {*
230
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
    99
  get_fun absF [(@{typ qt}, @{typ t})] @{context} @{typ "(qt \<Rightarrow> qt) \<Rightarrow> qt"}
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   100
  |> fst
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   101
  |> Syntax.pretty_term @{context}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   102
  |> Pretty.string_of
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   103
  |> writeln
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   104
*}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   105
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   106
(* A test whether get_fun works properly
177
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   107
consts bla :: "(t \<Rightarrow> t) \<Rightarrow> t"
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   108
local_setup {*
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   109
  fn lthy => (Toplevel.program (fn () =>
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   110
    make_const_def @{binding bla'} @{term "bla"} NoSyn @{typ "t"} @{typ "qt"} lthy
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   111
  )) |> snd
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   112
*}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   113
*)
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   114
284
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   115
consts Rl :: "'a list \<Rightarrow> 'a list \<Rightarrow> bool"
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   116
axioms Rl_eq: "EQUIV Rl"
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   117
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   118
quotient ql = "'a list" / "Rl"
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   119
  by (rule Rl_eq)
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   120
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   121
ML {* val al = snd (dest_Free (term_of @{cpat "f :: ?'a list"})) *}
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   122
ML {* val aq = snd (dest_Free (term_of @{cpat "f :: ?'a ql"})) *}
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   123
ML {* val ttt = snd (dest_Free (term_of @{cpat "f :: ?'a list \<Rightarrow> ?'a list"})) *}
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   124
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   125
ML {*
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   126
  get_fun absF [(al, aq)] @{context} ttt
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   127
  |> fst
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   128
  |> Syntax.pretty_term @{context}
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   129
  |> Pretty.string_of
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   130
  |> writeln
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   131
*}
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   132
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   133
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   134
ML {* val ttt2 = snd (dest_Free (term_of @{cpat "f :: nat list \<Rightarrow> nat list"})) *}
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   135
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   136
ML {*
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   137
  get_fun absF [(al, aq)] @{context} ttt2
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   138
  |> fst
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   139
  |> Syntax.pretty_term @{context}
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   140
  |> Pretty.string_of
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   141
  |> writeln
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   142
*}
78bc4d9d7975 Two new tests for get_fun. Second one fails.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 254
diff changeset
   143
230
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   144
quotient_def (for qt)
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   145
  VR ::"string \<Rightarrow> qt"
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   146
where
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   147
  "VR \<equiv> vr"
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   148
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   149
quotient_def (for qt)
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   150
  AP ::"qt list \<Rightarrow> qt"
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   151
where
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   152
  "AP \<equiv> ap"
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   153
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   154
quotient_def (for qt)
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   155
  LM ::"string \<Rightarrow> qt \<Rightarrow> qt"
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   156
where
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   157
  "LM \<equiv> lm"
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   158
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   159
term vr
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   160
term ap
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   161
term lm
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   162
thm VR_def AP_def LM_def
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   163
term LM
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   164
term VR
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   165
term AP
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   166
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   167
text {* a test with functions *}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   168
datatype 'a t' =
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   169
  vr' "string"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   170
| ap' "('a t') * ('a t')"
177
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   171
| lm' "'a" "string \<Rightarrow> ('a t')"
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   172
177
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   173
consts Rt' :: "('a t') \<Rightarrow> ('a t') \<Rightarrow> bool"
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   174
axioms t_eq': "EQUIV Rt'"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   175
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   176
quotient qt' = "'a t'" / "Rt'"
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   177
  apply(rule t_eq')
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   178
  done
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   179
185
929bc55efff7 added code for declaring map-functions
Christian Urban <urbanc@in.tum.de>
parents: 180
diff changeset
   180
print_quotients
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   181
print_theorems
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   182
230
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   183
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   184
quotient_def (for "'a qt'")
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   185
  VR' ::"string \<Rightarrow> 'a qt"
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   186
where
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   187
  "VR' \<equiv> vr'"
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   188
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   189
quotient_def (for "'a qt'")
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   190
  AP' ::"('a qt') * ('a qt') \<Rightarrow> 'a qt"
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   191
where
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   192
  "AP' \<equiv> ap'"
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   193
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   194
quotient_def (for "'a qt'")
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   195
  LM' ::"'a \<Rightarrow> string \<Rightarrow> 'a qt'"
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   196
where
84a356e3d38b ported all constant definitions to new scheme
Christian Urban <urbanc@in.tum.de>
parents: 185
diff changeset
   197
  "LM' \<equiv> lm'"
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   198
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   199
term vr'
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   200
term ap'
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   201
term ap'
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   202
thm VR'_def AP'_def LM'_def
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   203
term LM'
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   204
term VR'
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   205
term AP'
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   206
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   207
text {* Tests of regularise *}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   208
ML {*
177
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   209
  cterm_of @{theory} (regularise @{term "\<lambda>x :: int. x"} @{typ "trm"} @{term "RR"} @{context});
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   210
  cterm_of @{theory} (regularise @{term "\<lambda>x :: trm. x"} @{typ "trm"} @{term "RR"} @{context});
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   211
  cterm_of @{theory} (regularise @{term "\<forall>x :: trm. P x"} @{typ "trm"} @{term "RR"} @{context});
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   212
  cterm_of @{theory} (regularise @{term "\<exists>x :: trm. P x"} @{typ "trm"} @{term "RR"} @{context});
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   213
  cterm_of @{theory} (regularise @{term "All (P :: trm \<Rightarrow> bool)"} @{typ "trm"} @{term "RR"} @{context});
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   214
*}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   215
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   216
ML {*
177
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   217
  cterm_of @{theory} (regularise @{term "\<exists>(y::trm). P (\<lambda>(x::trm). y)"} @{typ "trm"}
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   218
     @{term "RR"} @{context});
177
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   219
  cterm_of @{theory} (my_reg @{term "RR"} @{term "\<exists>(y::trm). P (\<lambda>(x::trm). y)"})
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   220
*}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   221
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   222
ML {*
177
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   223
  cterm_of @{theory} (regularise @{term "\<lambda>x::trm. x"} @{typ "trm"} @{term "RR"} @{context});
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   224
  cterm_of @{theory} (my_reg @{term "RR"} @{term "\<lambda>x::trm. x"})
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   225
*}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   226
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   227
ML {*
177
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   228
  cterm_of @{theory} (regularise @{term "\<forall>(x::trm) (y::trm). P x y"} @{typ "trm"} @{term "RR"} @{context});
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   229
  cterm_of @{theory} (my_reg @{term "RR"} @{term "\<forall>(x::trm) (y::trm). P x y"})
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   230
*}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   231
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   232
ML {*
177
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   233
  cterm_of @{theory} (regularise @{term "\<forall>x::trm. P x"} @{typ "trm"} @{term "RR"} @{context});
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   234
  cterm_of @{theory} (my_reg @{term "RR"} @{term "\<forall>x::trm. P x"})
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   235
*}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   236
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   237
ML {*
177
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   238
  cterm_of @{theory} (regularise @{term "\<exists>x::trm. P x"} @{typ "trm"} @{term "RR"} @{context});
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   239
  cterm_of @{theory} (my_reg @{term "RR"} @{term "\<exists>x::trm. P x"})
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   240
*}
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   241
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   242
(* my version is not eta-expanded, but that should be OK *)
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   243
ML {*
177
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   244
  cterm_of @{theory} (regularise @{term "All (P::trm \<Rightarrow> bool)"} @{typ "trm"} @{term "RR"} @{context});
bdfe4388955d changed encoding from utf8 to ISO8 (needed to work with xemacs)
Christian Urban <urbanc@in.tum.de>
parents: 163
diff changeset
   245
  cterm_of @{theory} (my_reg @{term "RR"} @{term "All (P::trm \<Rightarrow> bool)"})
163
3da18bf6886c Split Finite Set example into separate file
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   246
*}