equal
deleted
inserted
replaced
1 (* Title: HOL/Library/SCT_Misc.thy |
1 (* Title: HOL/Library/SCT_Misc.thy |
2 ID: $Id$ |
2 ID: $Id$ |
3 Author: Alexander Krauss, TU Muenchen |
3 Author: Alexander Krauss, TU Muenchen |
4 *) |
4 *) |
5 |
5 |
|
6 header "" |
|
7 |
6 theory SCT_Misc |
8 theory SCT_Misc |
7 imports Main |
9 imports Main |
8 begin |
10 begin |
9 |
11 |
10 subsection {* Searching in lists *} |
12 subsection {* Searching in lists *} |
19 by (induct l) auto |
21 by (induct l) auto |
20 |
22 |
21 lemma index_of_length: |
23 lemma index_of_length: |
22 "(x \<in> set l) = (index_of l x < length l)" |
24 "(x \<in> set l) = (index_of l x < length l)" |
23 by (induct l) auto |
25 by (induct l) auto |
|
26 |
24 |
27 |
25 subsection {* Some reasoning tools *} |
28 subsection {* Some reasoning tools *} |
26 |
29 |
27 lemma inc_induct[consumes 1]: |
30 lemma inc_induct[consumes 1]: |
28 assumes less: "i \<le> j" |
31 assumes less: "i \<le> j" |
65 assumes "\<And>R. \<lbrakk>a1 \<Longrightarrow> R; a2 \<Longrightarrow> R; a3 \<Longrightarrow> R\<rbrakk> \<Longrightarrow> R" |
68 assumes "\<And>R. \<lbrakk>a1 \<Longrightarrow> R; a2 \<Longrightarrow> R; a3 \<Longrightarrow> R\<rbrakk> \<Longrightarrow> R" |
66 shows "thesis" |
69 shows "thesis" |
67 using prems |
70 using prems |
68 by auto |
71 by auto |
69 |
72 |
70 section {* Sequences *} |
73 |
|
74 subsection {* Sequences *} |
71 |
75 |
72 types |
76 types |
73 'a sequence = "nat \<Rightarrow> 'a" |
77 'a sequence = "nat \<Rightarrow> 'a" |
74 |
78 |
75 subsection {* Increasing sequences *} |
79 |
|
80 subsubsection {* Increasing sequences *} |
76 |
81 |
77 definition increasing :: "(nat \<Rightarrow> nat) \<Rightarrow> bool" |
82 definition increasing :: "(nat \<Rightarrow> nat) \<Rightarrow> bool" |
78 where |
83 where |
79 "increasing s = (\<forall>i j. i < j \<longrightarrow> s i < s j)" |
84 "increasing s = (\<forall>i j. i < j \<longrightarrow> s i < s j)" |
80 |
85 |
113 with increasing_weak have "s j \<le> s i" by simp |
118 with increasing_weak have "s j \<le> s i" by simp |
114 with `s i < s j` show ?thesis by simp |
119 with `s i < s j` show ?thesis by simp |
115 qed |
120 qed |
116 qed (simp add:increasing_strict) |
121 qed (simp add:increasing_strict) |
117 |
122 |
118 subsection {* Sections induced by an increasing sequence *} |
123 |
|
124 subsubsection {* Sections induced by an increasing sequence *} |
119 |
125 |
120 abbreviation |
126 abbreviation |
121 "section s i == {s i ..< s (Suc i)}" |
127 "section s i == {s i ..< s (Suc i)}" |
122 |
128 |
123 definition |
129 definition |