equal
deleted
inserted
replaced
|
1 (* Title: Pure/ex/Def_Examples.thy |
|
2 Author: Makarius |
|
3 |
|
4 Some examples for primitive definitions. |
|
5 *) |
|
6 |
|
7 theory Def_Examples |
|
8 imports Def |
|
9 begin |
|
10 |
|
11 section \<open>Global definitions\<close> |
|
12 |
|
13 def "I x \<equiv> x" |
|
14 def "K x y \<equiv> x" |
|
15 def "S x y z \<equiv> (x z) (y z)" |
|
16 |
|
17 lemma "I (I x) \<equiv> x" |
|
18 by simp |
|
19 |
|
20 lemma "K a x \<equiv> K a y" |
|
21 by simp |
|
22 |
|
23 lemma "S K K \<equiv> I" |
|
24 by simp |
|
25 |
|
26 |
|
27 section \<open>Locale definitions\<close> |
|
28 |
|
29 locale const = |
|
30 fixes a :: 'a |
|
31 begin |
|
32 |
|
33 def "fun b \<equiv> a" |
|
34 |
|
35 lemma "fun x \<equiv> fun y" |
|
36 by simp |
|
37 |
|
38 end |
|
39 |
|
40 lemma "const.fun a x \<equiv> const.fun a y" |
|
41 by simp |
|
42 |
|
43 end |