domain ('s, 'a) R = Done (lazy"'a") | More (lazy"('s, ('s, 'a) R) N")
thm R.take_induct
lemma R_induct [case_names adm bottom Done More, induct type: R]: fixes P :: "('s, 'a) R ==> bool" assumes adm: "adm P" assumes bottom: "P ⊥" assumesDone: "∧x. P (Done⋅x)" assumes More: "∧p c. (∧r::('s, 'a) R. P (p⋅r)) ==> P (More⋅(mapN⋅p⋅c))" shows"P r" proof (induct r rule: R.take_induct) show"adm P"by fact next fix n show"P (R_take n⋅r)" proof (induct n arbitrary: r) case 0 show ?caseby (simp add: bottom) next case (Suc n r) show ?case apply (cases r) apply (simp add: bottom) apply (simp add: Done) using More [OF Suc] apply (simp add: mapN_def) done qed qed
lemma mapR_zipR: "mapR⋅h⋅(zipR⋅f⋅a⋅b) = zipR⋅(Λ x y. h⋅(f⋅x⋅y))⋅a⋅b" apply (induct a arbitrary: b) apply simp apply simp apply (simp add: zipR_Done_left zipR_Done_right mapR_mapR) apply (induct_tac b) apply simp apply simp apply (simp add: mapN_mapN) apply (simp add: mapN_mapN mapN_plusN) done
lemma zipR_mapR_left: "zipR⋅f⋅(mapR⋅h⋅a)⋅b = zipR⋅(Λ x y. f⋅(h⋅x)⋅y)⋅a⋅b" apply (induct a arbitrary: b) apply simp apply simp apply (simp add: zipR_Done_left zipR_Done_right eta_cfun) apply (simp add: mapN_mapN) apply (induct_tac b) apply simp apply simp apply (simp add: mapN_mapN) apply (simp add: mapN_mapN) done
lemma zipR_mapR_right: "zipR⋅f⋅a⋅(mapR⋅h⋅b) = zipR⋅(Λ x y. f⋅x⋅(h⋅y))⋅a⋅b" apply (induct b arbitrary: a) apply simp apply simp apply (simp add: zipR_Done_left zipR_Done_right) apply (simp add: mapN_mapN) apply (induct_tac a) apply simp apply simp apply (simp add: mapN_mapN) apply (simp add: mapN_mapN) done
lemma zipR_commute: assumes f: "∧x y. f⋅x⋅y = g⋅y⋅x" shows"zipR⋅f⋅a⋅b = zipR⋅g⋅b⋅a" apply (induct a arbitrary: b) apply simp apply simp apply (simp add: zipR_Done_left zipR_Done_right f [symmetric] eta_cfun) apply (induct_tac b) apply simp apply simp apply (simp add: mapN_mapN) apply (simp add: mapN_mapN mapN_plusN plusN_commute) done
lemma zipR_assoc: fixes a :: "('s, 'a) R"and b :: "('s, 'b) R"and c :: "('s, 'c) R" fixes f :: "'a → 'b → 'd"and g :: "'d → 'c → 'e" assumes gf: "∧x y z. g⋅(f⋅x⋅y)⋅z = h⋅x⋅(k⋅y⋅z)" shows"zipR⋅g⋅(zipR⋅f⋅a⋅b)⋅c = zipR⋅h⋅a⋅(zipR⋅k⋅b⋅c)" (is"?P a b c") apply (induct a arbitrary: b c) apply simp apply simp apply (simp add: zipR_Done_left zipR_Done_right) apply (simp add: zipR_mapR_left mapR_zipR gf) apply (rename_tac pA kA b c) apply (rule_tac x=c in spec) apply (induct_tac b) apply simp apply simp apply (simp add: mapN_mapN) apply (simp add: zipR_Done_left zipR_Done_right eta_cfun) apply (simp add: zipR_mapR_right) apply (rule allI, rename_tac c) apply (induct_tac c) apply simp apply simp apply (rename_tac z) apply (simp add: mapN_mapN) apply (simp add: zipR_mapR_left gf) apply (rename_tac pC kC) apply (simp add: mapN_mapN) apply (simp add: zipR_mapR_left gf) apply (rename_tac pB kB) apply (rule allI, rename_tac c) apply (induct_tac c) apply simp apply simp apply (simp add: mapN_mapN mapN_plusN) apply (rename_tac pC kC) apply (simp add: mapN_mapN mapN_plusN plusN_assoc) done
text‹Alternative proof using take lemma.›
lemma fixes a :: "('s, 'a) R"and b :: "('s, 'b) R"and c :: "('s, 'c) R" fixes f :: "'a → 'b → 'd"and g :: "'d → 'c → 'e" assumes gf: "∧x y z. g⋅(f⋅x⋅y)⋅z = h⋅x⋅(k⋅y⋅z)" shows"zipR⋅g⋅(zipR⋅f⋅a⋅b)⋅c = zipR⋅h⋅a⋅(zipR⋅k⋅b⋅c)"
(is"?lhs = ?rhs"is"?P a b c") proof (rule R.take_lemma) fix n show"R_take n⋅?lhs = R_take n⋅?rhs" proof (induct n arbitrary: a b c) case (0 a b c) show ?caseby simp next case (Suc n a b c) note IH = this let ?P = ?case show ?case proof (cases a) case bottom thus ?P by simp next case (Done x) thus ?P by (simp add: zipR_Done_left zipR_mapR_left mapR_zipR gf) next case (More nA) thus ?P proof (cases b) case bottom thus ?P by simp next case (Done y) thus ?P by (simp add: zipR_Done_left zipR_Done_right
zipR_mapR_left zipR_mapR_right gf) next case (More nB) thus ?P proof (cases c) case bottom thus ?P by simp next case (Done z) thus ?P by (simp add: zipR_Done_right mapR_zipR zipR_mapR_right gf) next case (More nC) note H = ‹a = More⋅nA›‹b = More⋅nB›‹c = More⋅nC› show ?P apply (simp only: H zipR_More_More) apply (simplesubst zipR_More_More [of f, symmetric]) apply (simplesubst zipR_More_More [of k, symmetric]) apply (simp only: H [symmetric]) apply (simp add: mapN_mapN mapN_plusN plusN_assoc IH) done qed qed qed qed qed
end
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet am 2026-04-25)
¤
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.