theory"C-restr" imports C "C-Meet""HOLCF-Utils" begin
subsubsection‹The demand of a $C$-function›
text‹
demand is the least amount of resources required to produce a non-bottom element,
at all. ›
definition demand :: "(C → 'a::pcpo) ==> C"where "demand f = (if f⋅C\<infinity> ≠⊥ then CLEAST n. f⋅C≠⊥) else C\<infinity>)"
text‹
of continuity, a non-bottom value can always be obtained with finite resources. ›
lemma finite_resources_suffice: assumes"f⋅C\<infinity> ≠⊥" obtains n where"f⋅C≠⊥" proof-
{ assume"∀n. f⋅(C) = ⊥" hence"f⋅C\<infinity> ⊑⊥" by (auto intro: lub_below[OF ch2ch_Rep_cfunR[OF chain_iterate]]
simp add: Cinf_def fix_def2 contlub_cfun_arg[OF chain_iterate]) with assms have False by simp
} thus ?thesis using that by blast qed
text‹
of monotonicity, a non-bottom value can always be obtained with more resources. ›
lemma more_resources_suffice: assumes"f⋅r ≠⊥"and"r ⊑ r'" shows"f⋅r' ≠⊥" using assms(1) monofun_cfun_arg[OF assms(2), where f = f] by auto
lemma not_bot_demand: "f⋅r ≠⊥⟷ demand f ≠ C\<infinity> ∧ demand f ⊑ r" proof(intro iffI) assume"f⋅r ≠⊥" thus"demand f ≠ C\<infinity> ∧ demand f ⊑ r" apply (cases r rule:C_cases) apply (auto intro: Least_le simp add: demand_def dest: infinite_resources_suffice) done next assume *: "demand f ≠ C\<infinity> ∧ demand f ⊑ r" thenhave"f⋅C\<infinity> ≠⊥"by (auto intro: Least_le simp add: demand_def dest: infinite_resources_suffice) hence"f⋅(demand f) ≠⊥"by (rule demand_suffices) moreoverfrom * have"demand f ⊑ r".. ultimately show"f⋅r ≠⊥"by (rule more_resources_suffice) qed
lemma infinity_bot_demand: "f⋅C\<infinity> = ⊥⟷ demand f = C\<infinity>" by (metis below_Cinf not_bot_demand)
lemma demand_suffices': assumes"demand f = C" shows"f⋅(demand f) ≠⊥" by (metis C_eq_Cinf assms demand_suffices infinity_bot_demand)
lemma demand_Suc_Least: assumes [simp]: "f⋅⊥ = ⊥" assumes"demand f ≠ C\<infinity>" shows"demand f = CSuc (LEAST n. f⋅C n≠⊥))" proof- from assms have"demand f = CLEAST n. f⋅C≠⊥)"by (auto simp add: demand_def) also thenobtain n where"f⋅C≠⊥"by (metis demand_suffices') hence"(LEAST n. f⋅C≠⊥) = Suc (LEAST n. f⋅C n≠⊥)" apply (rule Least_Suc) by simp finallyshow ?thesis. qed
lemma demand_C_case[simp]: "demand (C_case⋅f) = C ⋅ (demand f)" proof(cases "demand (C_case⋅f) = C\<infinity>") case True thenhave"C_case⋅f⋅C\<infinity> = ⊥" by (metis infinity_bot_demand) with True show ?thesis apply auto by (metis infinity_bot_demand) next case False hence"demand (C_case⋅f) = C (LEAST n. (C_case⋅f)⋅C n≠⊥)" by (rule demand_Suc_Least[OF C.case_rews(1)]) alsohave"… = C⋅C n. f⋅C≠⊥"by simp alsohave"… = C⋅(demand f)" using False unfolding demand_def by auto finallyshow ?thesis. qed
lemma demand_contravariant: assumes"f ⊑ g" shows"demand g ⊑ demand f" proof(cases "demand f" rule:C_cases) fix n assume"demand f = C" hence"f⋅(demand f) ≠⊥"by (metis demand_suffices') alsonote monofun_cfun_fun[OF assms] finallyhave"g⋅(demand f) ≠⊥"by this (intro cont2cont) thus"demand g ⊑ demand f"unfolding not_bot_demand by auto qed auto
subsubsection‹Restricting functions with domain C›
lemma env_C_restr_lookup[simp]: "(ρ|\<circ>) v = ρ v|" unfolding env_C_restr_def by simp
lemma env_C_restr_bot[simp]: " ⊥|\<circ> = ⊥" unfolding env_C_restr_def by auto
lemma env_C_restr_restr_below[intro]: "ρ|\<circ>⊑ ρ" by (auto intro: fun_belowI)
lemma env_C_restr_env_C_restr[simp]: "(v|\<circ>')|\<circ> = v|\<circ>r' ⊓ r)" unfolding env_C_restr_def by auto
lemma env_C_restr_cong: "(∧ x r'. r' ⊑ r ==> f x ⋅ r' = g x ⋅ r') ==> f|\<circ> = g|\<circ>" unfolding env_C_restr_def by (rule ext) (auto intro: C_restr_cong)
end
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-10)
¤
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.