theory Timestamp imports"HOL-Library.Extended_Nat""HOL-Library.Extended_Real" begin
class embed_nat = fixes ι :: "nat ==> 'a"
class tfin = fixes tfin :: "'a set"
class timestamp = comm_monoid_add + semilattice_sup + embed_nat + tfin + assumes ι_mono: "∧i j. i ≤ j ==> ι i ≤ ι j" and ι_tfin: "∧i. ι i ∈ tfin" and ι_progressing: "x ∈ tfin ==>∃j. ¬ι j ≤ ι i + x" and zero_tfin: "0 ∈ tfin" and tfin_closed: "c ∈ tfin ==> d ∈ tfin ==> c + d ∈ tfin" and add_mono: "c ≤ d ==> a + c ≤ a + d" and add_pos: "a ∈ tfin ==> 0 < c ==> a < a + c" begin
lemma add_mono_comm: fixes a :: 'a shows"c ≤ d ==> c + a ≤ d + a" by (auto simp: add.commute add_mono)
end
(* Extending time domain with infinity (None). *)
instantiation option :: (timestamp) timestamp begin
definition ι_option :: "nat ==> 'a option"where "ι_option = Some ∘ ι"
definition zero_option :: "'a option"where "zero_option = Some 0"
definition plus_option :: "'a option ==> 'a option ==> 'a option"where "plus_option x y = (case x of None ==> None | Some x' ==> (case y of None ==> None | Some y' ==> Some (x' + y')))"
definition sup_option :: "'a option ==> 'a option ==> 'a option"where "sup_option x y = (case x of None ==> None | Some x' ==> (case y of None ==> None | Some y' ==> Some (sup x' y')))"
definition less_option :: "'a option ==> 'a option ==> bool"where "less_option x y = (case x of None ==> False | Some x' ==> (case y of None ==> True | Some y' ==> x' < y'))"
definition less_eq_option :: "'a option ==> 'a option ==> bool"where "less_eq_option x y = (case x of None ==> x = y | Some x' ==> (case y of None ==> True | Some y' ==> x' ≤ y'))"
lemma ereal_add_pos: fixes a :: ereal shows"a ∈ tfin ==> 0 < c ==> a < a + c" by (auto simp: tfin_ereal_def) (metis add.right_neutral ereal_add_cancel_left ereal_le_add_self order_less_le)
instance by standard (auto simp add: ι_ereal_def tfin_ereal_def add.commute ereal_add_le_add_iff2 not_le
less_PInf_Ex_of_nat ereal_less_ereal_Ex reals_Archimedean2 intro: ereal_add_pos)
end
class timestamp_total = timestamp + assumes timestamp_total: "a ≤ b ∨ b ≤ a" assumes timestamp_tfin_le_not_tfin: "0 ≤ a ==> a ∈ tfin ==> 0 ≤ b ==> b ∉ tfin ==> a ≤ b" begin
lemma add_not_tfin: "0 ≤ a ==> a ∈ tfin ==> a ≤ c ==> c ∈ tfin ==> 0 ≤ b ==> b ∉ tfin ==> c < a + b" by (metis add_0_left local.add_mono_comm timestamp_tfin_le_not_tfin dual_order.order_iff_strict dual_order.strict_trans1)
end
instantiation enat :: timestamp_total begin
instance by standard (auto simp: tfin_enat_def)
end
instantiation ereal :: timestamp_total begin
instance by standard (auto simp: tfin_ereal_def)
end
class timestamp_strict = timestamp + assumes add_mono_strict: "c < d ==> a + c < a + d"
class timestamp_total_strict = timestamp_total + timestamp_strict
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.