(* Title: ZF/Nat.thy Author: Lawrence C Paulson, Cambridge University Computer Laboratory Copyright 1994 University of Cambridge *)
section‹The Natural numbers As a Least Fixed Point›
theory Nat imports OrdQuant Bool begin
definition
nat :: i where "nat ≡ lfp(Inf, λX. {0} ∪ {succ(i). i ∈ X})"
definition
quasinat :: "i ==> o"where "quasinat(n) ≡ n=0 | (∃m. n = succ(m))"
definition (*Has an unconditional succ case, which is used in "recursor" below.*)
nat_case :: "[i, i==>i, i]==>i"where "nat_case(a,b,k) ≡ THE y. k=0 ∧ y=a | (∃x. k=succ(x) ∧ y=b(x))"
definition
nat_rec :: "[i, i, [i,i]==>i]==>i"where "nat_rec(k,a,b) ≡ wfrec(Memrel(nat), k, λn f. nat_case(a, λm. b(m, f`m), n))"
(*Internalized relations on the naturals*)
definition
Le :: i where "Le ≡ {⟨x,y⟩:nat*nat. x ≤ y}"
definition
Lt :: i where "Lt ≡ {⟨x, y⟩:nat*nat. x < y}"
definition
Ge :: i where "Ge ≡ {⟨x,y⟩:nat*nat. y ≤ x}"
definition
Gt :: i where "Gt ≡ {⟨x,y⟩:nat*nat. y < x}"
lemma natE: assumes"n ∈ nat" obtains ("0") "n=0" | (succ) x where"x ∈ nat""n=succ(x)" using assms by (rule nat_unfold [THEN equalityD1, THEN subsetD, THEN UnE]) auto
lemma complete_induct_rule [case_names less, consumes 1]: "i ∈ nat ==> (∧x. x ∈ nat ==> (∧y. y ∈ x ==> P(y)) ==> P(x)) ==> P(i)" using complete_induct [of i P] by simp
(*Induction starting from m rather than 0*) lemma nat_induct_from: assumes"m ≤ n""m ∈ nat""n ∈ nat" and"P(m)" and"∧x. [x ∈ nat; m ≤ x; P(x)]==> P(succ(x))" shows"P(n)" proof - from assms(3) have"m ≤ n ⟶ P(m) ⟶ P(n)" by (rule nat_induct) (use assms(5) in‹simp_all add: distrib_simps le_succ_iff›) with assms(1,2,4) show ?thesis by blast qed
(*Induction suitable for subtraction and less-than*) lemma diff_induct [case_names 0 0_succ succ_succ, consumes 2]: "[m ∈ nat; n ∈ nat; ∧x. x ∈ nat ==> P(x,0); ∧y. y ∈ nat ==> P(0,succ(y)); ∧x y. [x ∈ nat; y ∈ nat; P(x,y)]==> P(succ(x),succ(y))] ==> P(m,n)" apply (erule_tac x = m in rev_bspec) apply (erule nat_induct, simp) apply (rule ballI) apply (rename_tac i j) apply (erule_tac n=j in nat_induct, auto) done
(** Induction principle analogous to trancl_induct **)
subsection‹quasinat: to allow a case-split rule for 🍋‹nat_case›\ text‹True if the argument is zero or any successor› lemma [iff]: "quasinat(0)" by (simp add: quasinat_def)
lemma [iff]: "quasinat(succ(x))" by (simp add: quasinat_def)
(*needed to simplify unions over nat*) lemma nat_nonempty [simp]: "nat ≠ 0" by blast
text‹A natural number is the set of its predecessors› lemma nat_eq_Collect_lt: "i ∈ nat ==> {j∈nat. j apply (rule equalityI) apply (blast dest: ltD) apply (auto simp add: Ord_mem_iff_lt) apply (blast intro: lt_trans) done
lemma Le_iff [iff]: "⟨x,y⟩∈ Le ⟷ x ≤ y ∧ x ∈ nat ∧ y ∈ nat" by (force simp add: Le_def)
end
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-04-30)
¤
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 und die Messung sind noch experimentell.