doc-src/Locales/Locales/Examples2.thy
author ballarin
Sat, 28 Mar 2009 22:14:21 +0100
changeset 30780 c3f1e8a9e0b5
parent 30580 cc5a55d7a5be
child 30826 a53f4872400e
permissions -rw-r--r--
Default mode of qualifiers in locale commands.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
27063
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
     1
theory Examples2
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
     2
imports Examples
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
     3
begin
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
     4
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
     5
text {* This is achieved by unfolding suitable equations during
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
     6
  interpretation.  These equations are given after the keyword
30580
cc5a55d7a5be Updated chapters 1-5 to locale reimplementation.
ballarin
parents: 29293
diff changeset
     7
  \isakeyword{where} and require proofs.  The revised command
cc5a55d7a5be Updated chapters 1-5 to locale reimplementation.
ballarin
parents: 29293
diff changeset
     8
  that replaces @{text "\<sqsubset>"} by @{text "<"}, is: *}
27063
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
     9
30780
c3f1e8a9e0b5 Default mode of qualifiers in locale commands.
ballarin
parents: 30580
diff changeset
    10
interpretation %visible nat: partial_order "op \<le> :: [nat, nat] \<Rightarrow> bool"
27063
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    11
  where "partial_order.less op \<le> (x::nat) y = (x < y)"
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    12
proof -
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    13
  txt {* The goals are @{subgoals [display]}
30580
cc5a55d7a5be Updated chapters 1-5 to locale reimplementation.
ballarin
parents: 29293
diff changeset
    14
    The proof that @{text \<le>} is a partial order is as above. *}
27063
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    15
  show "partial_order (op \<le> :: nat \<Rightarrow> nat \<Rightarrow> bool)"
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    16
    by unfold_locales auto
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    17
  txt {* The second goal is shown by unfolding the
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    18
    definition of @{term "partial_order.less"}. *}
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    19
  show "partial_order.less op \<le> (x::nat) y = (x < y)"
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    20
    unfolding partial_order.less_def [OF `partial_order op \<le>`]
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    21
    by auto
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    22
qed
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    23
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    24
text {* Note that the above proof is not in the context of a locale.
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    25
  Hence, the correct interpretation of @{text
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    26
  "partial_order.less_def"} is obtained manually with @{text OF}.
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    27
  *}
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    28
d1d35284542f New version covering interpretation.
ballarin
parents:
diff changeset
    29
end