Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Doc/Tutorial/Inductive/   (Beweissystem Isabelle Version 2025-1©)  Datei vom 16.11.2025 mit Größe 3 kB image not shown  

Quelle  Mutual.thy   Sprache: Isabelle

 
(*<*)theory Mutual imports Main begin(*>*)

subsection\<open>

text
Just as are datatypes by recursion there are sets defined
by mutual induction. As a trivial we  the even odd
natural:
\<close>

inductive_set numbers\<close>
  Evennat"and
  Odd  :: "nat set"
where
  zero:  "0 \ Even"
| EvenI: "n \ Odd \ Suc n \ Even"
| OddI:  "n \ Even \ Suc n \ Odd"

text\<open>\noindent
The mutually inductive definition of multiple sets is no different from
that of a single set, except for induction: just as for mutually recursive
datatypes, induction needs to involve all the simultaneously defined sets. In
the above case, the induction rule is called @{thm[source]Even_Odd.induct}
(simply concatenate the names of the sets involved) and has the conclusion
@{text[display]"(?x \ Even \ ?P ?x) \ (?y \ Odd \ ?Q ?y)"}

If we want to prove that all even numbers are divisible by two, we have to
generalize the statement as follows:
\<close>

lemma "(m \ Even \ 2 dvd m) \ (n \ Odd \ 2 dvd (Suc n))"

txt\<open>\noindent
The proof is by rule induction. Because of the form of the induction theorem,
it is applied by \<open>rule\<close> rather than \<open>erule\<close> as for ordinary
inductive definitions:
\<close>

apply(rule Even_Odd.induct)

txt\<open>
@{subgoals[display,indent=0]}
The first two subgoals are proved by simplification and the final one can be
proved in the same manner as in \S\ref{sec:rule-induction}
where  same subgoal encountered.
We notshow proofscriptzero:  "0\ Even"
\<close>
(*<*):  "n \ Even \ Suc n \ Odd"
  apply simp
The inductive definition  multiple isno from
apply(imp: dvd_def, induction to all the simultaneously setsIn
apply(clarify)
apply(rule_tac x = "Suc k" in exI)
apply simp
done
(*>*)

subsection\<open>Inductively Defined Predicates\label{sec:ind-predicates}\<close>

textjava.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
Instead a  numbers can define a predicate \<^typ>\<open>nat\<close>:
\<close>

inductivegeneralize  statementas followsjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
zeroevn java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
"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 isapplied by 
\<^prop>\<open>evn n\<close> instead of \<^prop>\<open>n \<in> Even\<close>.
When  ann-ary as apredicate is tojava.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74
the: its should \mbox{\<open>\<tau>\<^sub>1 \<Rightarrow> \<dots> \<Rightarrow> \<tau>\<^sub>n \<Rightarrow> bool\<close>}
rather in same as \S\ref{sec:rule-induction}
\<open>\<tau>\<^sub>1 \<times> \<dots> \<times> \<tau>\<^sub>n \<Rightarrow> bool\<close>. The curried version facilitates inductions.

  not thescript
\index{inductive predicates|)}
\<close>

  apply simp

98%


¤ Dauer der Verarbeitung: 0.1 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.