lemma listall_conj1: "listall (λx. P x ∧ Q x) xs ==> listall P xs" by (induct xs) simp_all
lemma listall_conj2: "listall (λx. P x ∧ Q x) xs ==> listall Q xs" by (induct xs) simp_all
lemma listall_app: "listall P (xs @ ys) = (listall P xs ∧ listall P ys)" by (induct xs; intro iffI; simp)
lemma listall_snoc [simp]: "listall P (xs @ [x]) = (listall P xs ∧ P x)" by (rule iffI; simp add: listall_app)
lemma listall_cong [cong, extraction_expand]: "xs = ys ==> listall P xs = listall P ys"
― ‹Currently needed for strange technical reasons› by (unfold listall_def) simp
text‹ term‹listsp› is equivalent to term‹listall›, but cannot be
for program extraction. ›
lemma listall_listsp_eq: "listall P xs = listsp P xs" by (induct xs) (auto intro: listsp.intros)
inductive NF :: "dB ==> bool" where
App: "listall NF ts ==> NF (Var x 🍋🍋 ts)"
| Abs: "NF t ==> NF (Abs t)" monos listall_def
lemma nat_eq_dec: "∧n::nat. m = n ∨ m ≠ n" proof (induction m) case0 thenshow ?case by (cases n; simp only: nat.simps; iprover) next case (Suc m) thenshow ?case by (cases n; simp only: nat.simps; iprover) qed
lemma nat_le_dec: "∧n::nat. m < n ∨¬ (m < n)" proof (induction m) case0 thenshow ?case by (cases n; simp only: order.irrefl zero_less_Suc; iprover) next case (Suc m) thenshow ?case by (cases n; simp only: not_less_zero Suc_less_eq; iprover) qed
lemma App_NF_D: assumes NF: "NF (Var n 🍋🍋 ts)" shows"listall NF ts"using NF by cases simp_all
subsection‹Properties of ‹NF››
lemma Var_NF: "NF (Var n)" proof - have"NF (Var n 🍋🍋 [])" by (rule NF.App) simp thenshow ?thesis by simp qed
lemma Abs_NF: assumes NF: "NF (Abs t 🍋🍋 ts)" shows"ts = []"using NF proof cases case (App us i) thus ?thesis by (simp add: Var_apps_neq_Abs_apps [THEN not_sym]) next case (Abs u) thus ?thesis by simp qed
lemma lift_terms_NF: "listall NF ts ==> listall (λt. ∀i. NF (lift t i)) ts ==> listall NF (map (λt. lift t i) ts)" by (induct ts) simp_all
lemma lift_NF: "NF t ==> NF (lift t i)" apply (induct arbitrary: i set: NF) apply (frule listall_conj1) apply (drule listall_conj2) apply (drule_tac i=i in lift_terms_NF) apply assumption apply (rule_tac m1=x and n1=i in nat_le_dec [THEN disjE]) apply (simp_all add: NF.App NF.Abs) done
text‹ term‹NF› characterizes exactly the terms that are in normal form. ›
lemma NF_eq: "NF t = (∀t'. ¬ t →\<beta> t')" proof assume"NF t" thenhave"∧t'. ¬ t →\<beta> t'" proof induct case (App ts t) show ?case proof assume"Var t 🍋🍋 ts →\<beta> t'" thenobtain rs where"ts => rs" by (iprover dest: head_Var_reduction) with App show False by (induct rs arbitrary: ts) auto qed next case (Abs t) show ?case proof assume"Abs t →\<beta> t'" thenshow False using Abs by cases simp_all qed qed thenshow"∀t'. ¬ t →\<beta> t'" .. next assume H: "∀t'. ¬ t →\<beta> t'" thenshow"NF t" proof (induct t rule: Apps_dB_induct) case (1 n ts) thenhave"∀ts'. ¬ ts => ts'" by (iprover intro: apps_preserves_betas) with1(1) have"listall NF ts" by (induct ts) auto thenshow ?caseby (rule NF.App) next case (2 u ts) show ?case proof (cases ts) case Nil from2have"∀u'. ¬ u →\<beta> u'" by (auto intro: apps_preserves_beta) thenhave"NF u"by (rule 2) thenhave"NF (Abs u)"by (rule NF.Abs) with Nil show ?thesis by simp next case (Cons r rs) have"Abs u 🍋 r →\<beta> u[r/0]" .. thenhave"Abs u 🍋 r 🍋🍋 rs →\<beta> u[r/0] 🍋🍋 rs" by (rule apps_preserves_beta) with Cons have"Abs u 🍋🍋 ts →\<beta> u[r/0] 🍋🍋 rs" by simp with2show ?thesis by iprover qed qed qed
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.