forked from mukeshtiwari/Isabelle
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConcrete.thy
More file actions
62 lines (42 loc) · 1.29 KB
/
Concrete.thy
File metadata and controls
62 lines (42 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
theory Concrete
imports Main
begin
datatype bool = True | False
fun conj :: "bool \<Rightarrow> bool \<Rightarrow> bool" where
"conj True True = True" |
"conj _ _ = False"
datatype nat = Z | Succ nat
fun add :: "nat \<Rightarrow> nat \<Rightarrow> nat" where
"add Z n = n" |
"add (Succ m) n = Succ (add m n)"
lemma add_02: "add m Z = m"
apply (induction m)
apply simp
apply simp
done
datatype 'a list = Nil | Cons 'a "'a list"
fun app :: "'a list \<Rightarrow> 'a list \<Rightarrow> 'a list" where
"app Nil ys = ys" |
"app (Cons x xs) ys = Cons x (app xs ys)"
fun rev :: "'a list \<Rightarrow> 'a list" where
"rev Nil = Nil" |
"rev (Cons x xs) = app (rev xs) (Cons x Nil)"
theorem app_Nil2 [simp] : "app xs Nil = xs"
apply (induction xs)
apply auto
done
theorem app_assoc [simp] : "app (app xs ys) zs = app xs (app ys zs)"
apply (induction xs)
apply auto
done
theorem rev_app [simp] : "rev (app xs ys) = app (rev ys) (rev xs)"
apply (induction xs)
apply auto
done
theorem rev_rev [simp] : "rev (rev xs) = xs"
apply (induction xs)
apply auto
done
fun map :: "('a \<Rightarrow> 'b) \<Rightarrow> 'a list \<Rightarrow> 'b list" where
"map f Nil = Nil" |
"map f (Cons x xs) = Cons (f x) (map f xs)"