privatelemma map_uprod_parametric': "((A ===> B) ===> rel_prod A A ===> rel_prod B B) (λf. map_prod f f) (λf. map_prod f f)" by transfer_prover
lift_definition map_uprod :: "('a → 'b) → 'a uprod → 'b uprod"is"λf. map_prod f f"
parametric map_uprod_parametric' by auto
lemma map_uprod_simps [simp, code]: "map_uprod f (Upair x y) = Upair (f x) (f y)" by transfer simp
privatelemma rel_uprod_transfer': "((A ===> B ===> (=)) ===> rel_prod A A ===> rel_prod B B ===> (=)) (λR (a, b) (c, d). R a c ∧ R b d ∨ R a d ∧ R b c) (λR (a, b) (c, d). R a c ∧ R b d∨ R a d ∧ R b c)" by transfer_prover
lift_definition rel_uprod :: "('a → 'b → bool) → 'a uprod → 'b uprod → bool" is"λR (a, b) (c, d). R a c ∧ R b d ∨ R a d ∧ R b c" parametric rel_uprod_transfer' by auto
lemma rel_uprod_simps [simp, code]: "rel_uprod R (Upair a b) (Upair c d) ⟷ R a c ∧ R b d ∨ R a d ∧ R b c" by transfer auto
lemma Upair_parametric [transfer_rule]: "(A ===> A ===> rel_uprod A) Upair Upair" unfolding rel_fun_def by transfer auto
lemma case_uprod_parametric [transfer_rule]: "(rel_commute A B ===> rel_uprod A ===> B) case_uprod case_uprod" unfolding rel_fun_def by transfer(force dest: rel_funD)
end
bnf uprod: "'a uprod"
map: map_uprod
sets: set_uprod
bd: natLeq
rel: rel_uprod proof - show"map_uprod id = id"unfolding fun_eq_iff by transfer auto show"map_uprod (g ∘ f) = map_uprod g ∘ map_uprod f"for f :: "'a → 'b"and g :: "'b → 'c" unfolding fun_eq_iff by transfer auto show"map_uprod f x = map_uprod g x"if"∧z. z ∈ set_uprod x ==> f z = g z" for f :: "'a → 'b"and g x using that by transfer auto show"set_uprod ∘ map_uprod f = (`) f ∘ set_uprod"for f :: "'a → 'b"by transfer auto show"card_order natLeq"by(rule natLeq_card_order) show"BNF_Cardinal_Arithmetic.cinfinite natLeq"by(rule natLeq_cinfinite) show"regularCard natLeq"by(rule regularCard_natLeq) show"ordLess2 (card_of (set_uprod x)) natLeq"for x :: "'a uprod" by (auto simp flip: finite_iff_ordLess_natLeq) show"rel_uprod R OO rel_uprod S ≤ rel_uprod (R OO S)" for R :: "'a → 'b → bool"and S :: "'b → 'c → bool"by(rule predicate2I)(transfer; auto) show"rel_uprod R = (λx y. ∃z. set_uprod z ⊆ {(x, y). R x y} ∧ map_uprod fst z = x∧ map_uprod snd z = y)" for R :: "'a → 'b → bool"by transfer(auto simp add: fun_eq_iff) qed
lemma pred_uprod_code [simp, code]: "pred_uprod P (Upair x y) ⟷ P x ∧ P y" by(simp add: pred_uprod_def)
lemma equal_uprod_code [code]: "HOL.equal (Upair x y) (Upair z u) ⟷ x = z ∧ y = u ∨ x = u ∧ y = z" unfolding equal_uprod_def by simp
instanceby standard(simp add: equal_uprod_def) end
quickcheck_generator uprod constructors: Upair
lemma UNIV_uprod: "UNIV = (λx. Upair x x) ` UNIV ∪ (λ(x, y). Upair x y) ` Sigma UNIV (λx. UNIV - {x})" apply(rule set_eqI) subgoalfor x by(cases x) auto done
contextbegin private lift_definition upair_inv :: "'a uprod → 'a" is"λ(x, y). if x = y then x else undefined"by auto
lemma finite_UNIV_prod [simp]: "finite (UNIV :: 'a uprod set) ⟷ finite (UNIV :: 'a set)" (is"?lhs = ?rhs") proof assume ?lhs hence"finite (range (λx :: 'a. Upair x x))"by(rule finite_subset[rotated]) simp hence"finite (upair_inv ` range (λx :: 'a. Upair x x))"by(rule finite_imageI) alsohave"upair_inv (Upair x x) = x"for x :: 'a by transfer simp thenhave"upair_inv ` range (λx :: 'a. Upair x x) = UNIV"by(auto simp add: image_image) finallyshow ?rhs . qed(simp add: UNIV_uprod)
end
lemma card_UNIV_uprod: "card (UNIV :: 'a uprod set) = card (UNIV :: 'a set) * (card (UNIV :: 'a set) + 1) div 2"
(is"?UPROD = ?A * _ div _") proof(cases "finite (UNIV :: 'a set)") case True from True obtain f :: "nat → 'a"where bij: "bij_betw f {0..<?A} UNIV" by (blast dest: ex_bij_betw_nat_finite) hence [simp]: "f ` {0..<?A} = UNIV"by(rule bij_betw_imp_surj_on) have"UNIV = (λ(x, y). Upair (f x) (f y)) ` (SIGMA x:{0..<?A}. {..x})" apply(rule set_eqI) subgoalfor x apply(cases x) apply(clarsimp) subgoalfor a b apply(cases "inv_into {0..<?A} f a ≤ inv_into {0..<?A} f b") subgoalby(rule rev_image_eqI[where x="(inv_into {0..<?A} f _, inv_into {0..<?A} f _)"])
(auto simp add: inv_into_into[where A="{0..<?A}"and f=f, simplified] intro: f_inv_into_f[where f=f, symmetric]) subgoal apply(simp only: not_le) apply(drule less_imp_le) apply(rule rev_image_eqI[where x="(inv_into {0..<?A} f _, inv_into {0..<?A} f _)"]) apply(auto simp add: inv_into_into[where A="{0..<?A}"and f=f, simplified] intro: f_inv_into_f[where f=f, symmetric]) done done done done hence"?UPROD = card …"by simp alsohave"… = card (SIGMA x:{0..<?A}. {..x})" apply(rule card_image) using bij[THEN bij_betw_imp_inj_on] by(simp add: inj_on_def Ball_def)(metis leD le_eq_less_or_eq le_less_trans) alsohave"… = sum Suc {0..<?A}" by (subst card_SigmaI) simp_all alsohave"… = sum of_nat {Suc 0..?A}" using sum.atLeastLessThan_reindex [symmetric, of Suc 0 ?A id] by (simp del: sum.op_ivl_Suc add: atLeastLessThanSuc_atLeastAtMost) alsohave"… = ?A * (?A + 1) div 2" using gauss_sum_from_Suc_0 [of ?A, where ?'a = nat] by simp finallyshow ?thesis . qed simp
end
Messung V0.5 in Prozent
¤ 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.0.25Bemerkung:
(vorverarbeitet am 2026-09-28)
¤
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.