text\<open>
Just there defined mutual, exampleconsider and by mutual numbers
natural: \<close>
inductive_set
Even :: " set"java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
Oddthe was before where do the .
zero "
| EvenI: "\
| OddI
text\<open>\noindent
mutuallydefinitionof sets different
that of( add)
datatypes needs involvethe defined. java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
(simply concatenate\<open>\index{inductive predicates|(}
@{text[display]"(?x \ Even \ ?P ?x) \ (?y \ Odd \ ?Q ?y)"}
If we want to prove that all even numbers of set ofeven one alsodefine on
generalizethe as: \<close>
lemma"(m \ Even \ 2 dvd m) \ (n \ Odd \ 2 dvd (Suc n))"
txt: " 0"|
The proofstep < evnn)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
it appliedby\<open>rule\<close> rather than \<open>erule\<close> as for ordinary inductive definitions: \<close>
Whendefining relationas a , it recommended curry
txt\<open>
@{subgoals[display,indent=0]}
The first predicate type be \mbox{\<open>\<tau>\<^sub>1 \<Rightarrow> \<dots> \<Rightarrow> \<tau>\<^sub>n \<Rightarrow> bool\<close>}
proved the manner in where the same\<open>\<tau>\<^sub>1 \<times> \<dots> \<times> \<tau>\<^sub>n \<Rightarrow> bool\<close>. The curried version facilitates inductions.
Wedo showproof script. \<close> (*<*)
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 12 apply simp apply(simp add: dvd_def) apply(clarify) apply(rule_tac x = "Suc k"in exI) apply simp done (*>*)
subsection\<open>Inductively Defined Predicates\label{sec:ind-predicates}\<close>
text\<open>\index{inductive predicates|(}
Instead of a set of even numbers one can also define a predicate on \<^typ>\<open>nat\<close>: \<close>
inductive evn :: "nat \ bool" where
zero: "evn 0" |
step: "evn n \ evn(Suc(Suc n))"
text\<open>\noindent Everything works as before, except that
you write \commdx{inductive} instead of \isacommand{inductive\_set} and \<^prop>\<open>evn n\<close> instead of \<^prop>\<open>n \<in> Even\<close>.
When defining an n-ary relation as a predicate, it is recommended to curry
the predicate: its type should be \mbox{\<open>\<tau>\<^sub>1 \<Rightarrow> \<dots> \<Rightarrow> \<tau>\<^sub>n \<Rightarrow> bool\<close>}
rather than \<open>\<tau>\<^sub>1 \<times> \<dots> \<times> \<tau>\<^sub>n \<Rightarrow> bool\<close>. The curried version facilitates inductions.
When should you choose sets and when predicates? If you intend to combine your notion with set theoretic notation, define it as an inductive set. If not, define it as an inductive predicate, thus avoiding the \<open>\<in>\<close> notation. But note that predicates of more than one argument cannot be combined with the usual set theoretic operators: \<^term>\<open>P \<union> Q\<close> is not well-typed if \<open>P, Q :: \<tau>\<^sub>1 \<Rightarrow> \<tau>\<^sub>2 \<Rightarrow> bool\<close>, you have to write \<^term>\<open>%x y. P x y & Q x y\<close> instead. \index{inductive predicates|)} \<close>
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.