Theory Set_Simple_Orders
section‹Abstract orders on explicit sets›
theory Set_Simple_Orders
imports
Type_Simple_Orders
"../Foundations/FNDS_Set_Ext"
begin
subsection‹Background›
text‹
Some of the results presented in this section were ported
(with amendments and additions) from the theories \<^text>‹Orderings›
and \<^text>‹Set_Interval› in the main library of Isabelle/HOL.
›
subsection‹Order operations›
locale ord_ow =
fixes U :: "'a set" and le ls :: "['a, 'a] ⇒ bool"
begin
tts_register_sbts le | U
proof-
assume "Domainp AB = (λx. x ∈ U)" "bi_unique AB" "right_total AB"
from tts_AA_eq_transfer[OF this] show ?thesis by auto
qed
tts_register_sbts ls | U
proof-
assume "Domainp AB = (λx. x ∈ U)" "bi_unique AB" "right_total AB"
from tts_AA_eq_transfer[OF this] show ?thesis by auto
qed
end
locale ord_syntax_ow = ord_ow U le ls
for U :: "'a set" and le ls :: "['a, 'a] ⇒ bool"
begin
notation
le ("'(≤⇩a')") and
le (infix "≤⇩a" 50) and
ls ("'(<⇩a')") and
ls (infix "<⇩a" 50)
abbreviation (input) ge (infix "≥⇩a" 50)
where "x ≥⇩a y ≡ y ≤⇩a x"
abbreviation (input) gt (infix ">⇩a" 50)
where "x >⇩a y ≡ y <⇩a x"
notation
ge ("'(≥⇩a')") and
ge (infix "≥⇩a" 50) and
gt ("'(>⇩a')") and
gt (infix ">⇩a" 50)
abbreviation Least where "Least ≡ Type_Simple_Orders.Least U (≤⇩a)"
abbreviation Greatest where "Greatest ≡ Type_Simple_Orders.Least U (≥⇩a)"
abbreviation min where "min ≡ Type_Simple_Orders.min (≤⇩a)"
abbreviation max where "max ≡ Type_Simple_Orders.min (≥⇩a)"
abbreviation lessThan (‹{..<⇩a_}›) where "{..<⇩au} ≡ on U with (<⇩a) : {..⊏u}"
abbreviation atMost (‹{..≤⇩a_}›) where "{..≤⇩au} ≡ on U with (≤⇩a) : {..⊏u}"
abbreviation greaterThan (‹{_<⇩a..}›) where "{l<⇩a..} ≡ on U with (>⇩a) : {..⊏l}"
abbreviation atLeast (‹{_≤⇩a..}›) where "{l≤⇩a..} ≡ on U with (≥⇩a) : {..⊏l}"
abbreviation greaterThanLessThan (‹{_<⇩a..<⇩a_}›)
where "{l<⇩a..<⇩au} ≡ on U with (<⇩a) (<⇩a) : {l⊏..⊏u}"
abbreviation atLeastLessThan (‹{_≤⇩a..<⇩a_}›)
where "{l≤⇩a..<⇩au} ≡ on U with (≤⇩a) (<⇩a) : {l⊏..⊏u}"
abbreviation greaterThanAtMost (‹{_<⇩a..≤⇩a_}›)
where "{l<⇩a..≤⇩au} ≡ on U with (<⇩a) (≤⇩a) : {l⊏..⊏u}"
abbreviation atLeastAtMost (‹{_≤⇩a..≤⇩a_}›)
where "{l≤⇩a..≤⇩au} ≡ on U with (≤⇩a) (≤⇩a) : {l⊏..⊏u}"
abbreviation lessThanGreaterThan (‹{_>⇩a..>⇩a_}›)
where "{l>⇩a..>⇩au} ≡ on U with (>⇩a) (>⇩a) : {l⊏..⊏u}"
abbreviation lessThanAtLeast (‹{_≥⇩a..>⇩a_}›)
where "{l≥⇩a..>⇩au} ≡ on U with (≥⇩a) (>⇩a) : {l⊏..⊏u}"
abbreviation atMostGreaterThan (‹{_>⇩a..≥⇩a_}›)
where "{l>⇩a..≥⇩au} ≡ on U with (>⇩a) (≥⇩a) : {l⊏..⊏u}"
abbreviation atMostAtLeast (‹{_≥⇩a..≥⇩a_}›)
where "{l≥⇩a..≥⇩au} ≡ on U with (≥⇩a) (≥⇩a) : {l⊏..⊏u}"
abbreviation bdd_above where "bdd_above ≡ bdd U (≤⇩a)"
abbreviation bdd_below where "bdd_below ≡ bdd U (≥⇩a)"
end
locale ord_dual_ow = ord_syntax_ow U le ls
for U :: "'a set" and le ls :: "['a, 'a] ⇒ bool"
begin
sublocale dual: ord_ow U ge gt .
end
locale ord_pair_ow = ord⇩a: ord_ow U⇩a le⇩a ls⇩a + ord⇩b: ord_ow U⇩b le⇩b ls⇩b
for U⇩a :: "'a set" and le⇩a ls⇩a and U⇩b :: "'b set" and le⇩b ls⇩b
begin
sublocale rev: ord_pair_ow U⇩b le⇩b ls⇩b U⇩a le⇩a ls⇩a .
end
locale ord_pair_syntax_ow = ord_pair_ow U⇩a le⇩a ls⇩a U⇩b le⇩b ls⇩b
for U⇩a :: "'a set" and le⇩a ls⇩a and U⇩b :: "'b set" and le⇩b ls⇩b
begin
sublocale ord⇩a: ord_syntax_ow U⇩a le⇩a ls⇩a + ord⇩b: ord_syntax_ow U⇩b le⇩b ls⇩b .
notation le⇩a (‹'(≤⇩a')›)
and le⇩a (infix ‹≤⇩a› 50)
and ls⇩a (‹'(<⇩a')›)
and ls⇩a (infix ‹<⇩a› 50)
and le⇩b (‹'(≤⇩b')›)
and le⇩b (infix ‹≤⇩b› 50)
and ls⇩b (‹'(<⇩b')›)
and ls⇩b (infix ‹<⇩b› 50)
notation ord⇩a.ge (‹'(≥⇩a')›)
and ord⇩a.ge (infix ‹≥⇩a› 50)
and ord⇩a.gt (‹'(>⇩a')›)
and ord⇩a.gt (infix ‹>⇩a› 50)
and ord⇩b.ge (‹'(≥⇩b')›)
and ord⇩b.ge (infix ‹≥⇩b› 50)
and ord⇩b.gt (‹'(>⇩b')›)
and ord⇩b.gt (infix ‹>⇩b› 50)
abbreviation mono⇩a⇩b
where "mono⇩a⇩b ≡ Type_Simple_Orders.mono U⇩a (≤⇩a) (≤⇩b)"
abbreviation mono⇩b⇩a
where "mono⇩b⇩a ≡ Type_Simple_Orders.mono U⇩b (≤⇩b) (≤⇩a)"
abbreviation antimono⇩a⇩b
where "antimono⇩a⇩b ≡ Type_Simple_Orders.mono U⇩a (≤⇩a) (≥⇩b)"
abbreviation antimono⇩b⇩a
where "antimono⇩b⇩a ≡ Type_Simple_Orders.mono U⇩b (≤⇩b) (≥⇩a)"
abbreviation strict_mono⇩a⇩b
where "strict_mono⇩a⇩b ≡ Type_Simple_Orders.mono U⇩a (<⇩a) (<⇩b)"
abbreviation strict_mono⇩b⇩a
where "strict_mono⇩b⇩a ≡ Type_Simple_Orders.mono U⇩b (<⇩b) (<⇩a)"
abbreviation strict_antimono⇩a⇩b
where "strict_antimono⇩a⇩b ≡ Type_Simple_Orders.mono U⇩a (<⇩a) (>⇩b)"
abbreviation strict_antimono⇩b⇩a
where "strict_antimono⇩b⇩a ≡ Type_Simple_Orders.mono U⇩b (<⇩b) (>⇩a)"
notation ord⇩a.lessThan (‹{..<⇩a_}›)
and ord⇩a.atMost (‹{..≤⇩a_}›)
and ord⇩a.greaterThan (‹{_<⇩a..}›)
and ord⇩a.atLeast (‹{_≤⇩a..}›)
and ord⇩a.greaterThanLessThan (‹{_<⇩a..<⇩a_}›)
and ord⇩a.atLeastLessThan (‹{_≤⇩a..<⇩a_}›)
and ord⇩a.greaterThanAtMost (‹{_<⇩a..≤⇩a_}›)
and ord⇩a.atLeastAtMost (‹{_≤⇩a..≤⇩a_}›)
and ord⇩a.lessThanGreaterThan (‹{_>⇩a..>⇩a_}›)
and ord⇩a.lessThanAtLeast (‹{_≥⇩a..>⇩a_}›)
and ord⇩a.atMostGreaterThan (‹{_>⇩a..≥⇩a_}›)
and ord⇩a.atMostAtLeast (‹{_≥⇩a..≥⇩a_}›)
and ord⇩b.lessThan (‹{..<⇩b_}›)
and ord⇩b.atMost (‹{..≤⇩b_}›)
and ord⇩b.greaterThan (‹{_<⇩b..}›)
and ord⇩b.atLeast (‹{_≤⇩b..}›)
and ord⇩b.greaterThanLessThan (‹{_<⇩b..<⇩b_}›)
and ord⇩b.atLeastLessThan (‹{_≤⇩b..<⇩b_}›)
and ord⇩b.greaterThanAtMost (‹{_<⇩b..≤⇩b_}›)
and ord⇩b.atLeastAtMost (‹{_≤⇩b..≤⇩b_}›)
and ord⇩b.lessThanGreaterThan (‹{_>⇩b..>⇩b_}›)
and ord⇩b.lessThanAtLeast (‹{_≥⇩b..>⇩b_}›)
and ord⇩b.atMostGreaterThan (‹{_>⇩b..≥⇩b_}›)
and ord⇩b.atMostAtLeast (‹{_≥⇩b..≥⇩b_}›)
end
locale ord_pair_dual_ow = ord_pair_syntax_ow U⇩a le⇩a ls⇩a U⇩b le⇩b ls⇩b
for U⇩a :: "'a set" and le⇩a ls⇩a and U⇩b :: "'b set" and le⇩b ls⇩b
context ord_pair_dual_ow
begin
sublocale ord_dual: ord_pair_ow U⇩a ‹(≤⇩a)› ‹(<⇩a)› U⇩b ‹(≥⇩b)› ‹(>⇩b)› .
sublocale dual_ord: ord_pair_ow U⇩a ‹(≥⇩a)› ‹(>⇩a)› U⇩b ‹(≤⇩b)› ‹(<⇩b)› .
sublocale dual_dual: ord_pair_ow U⇩a ‹(≥⇩a)› ‹(>⇩a)› U⇩b ‹(≥⇩b)› ‹(>⇩b)› .
end
subsubsection‹Relativization›
context ord_ow
begin
interpretation ord_syntax_ow .
tts_context
tts: (?'a to U)
sbterms: (‹?ls::?'a ⇒ ?'a ⇒ bool› to ls)
rewriting ctr_simps
eliminating through auto
begin
tts_lemma lessThan_iff:
assumes "i ∈ U" and "k ∈ U"
shows "(i ∈ {..<⇩ak}) = (i <⇩a k)"
is ord.lessThan_iff.
tts_lemma greaterThanLessThan_iff:
assumes "i ∈ U" and "l ∈ U" and "u ∈ U"
shows "(i ∈ {l<⇩a..<⇩au}) = (i <⇩a u ∧ l <⇩a i)"
is ord.greaterThanLessThan_iff.
tts_lemma greaterThanLessThan_eq:
assumes "a ∈ U" and "b ∈ U"
shows "{a<⇩a..<⇩ab} = {a<⇩a..} ∩ {..<⇩ab}"
is ord.greaterThanLessThan_eq.
end
tts_context
tts: (?'a to U)
sbterms: (‹?le::?'a ⇒ ?'a ⇒ bool› to le)
rewriting ctr_simps
eliminating through auto
begin
tts_lemma min_absorb1:
assumes "x ∈ U" and "y ∈ U" and "x ≤⇩a y"
shows "min x y = x"
is ord.min_absorb1.
tts_lemma atLeast_iff:
assumes "i ∈ U" and "k ∈ U"
shows "(i ∈ {k≤⇩a..}) = (k ≤⇩a i)"
is ord.atLeast_iff.
tts_lemma atLeastAtMost_iff:
assumes "i ∈ U" and "l ∈ U" and "u ∈ U"
shows "(i ∈ {l≤⇩a..≤⇩au}) = (i ≤⇩a u ∧ l ≤⇩a i)"
is ord.atLeastAtMost_iff.
end
tts_context
tts: (?'a to U)
sbterms: (‹?le::?'a ⇒ ?'a ⇒ bool› to le)
and (‹?ls::?'a ⇒ ?'a ⇒ bool› to ls)
rewriting ctr_simps
eliminating through auto
begin
tts_lemma atLeastLessThan_iff:
assumes "i ∈ U" and "l ∈ U" and "u ∈ U"
shows "(i ∈ {l≤⇩a..<⇩au}) = (l ≤⇩a i ∧ i <⇩a u)"
is ord.atLeastLessThan_iff.
tts_lemma greaterThanAtMost_iff:
assumes "i ∈ U" and "l ∈ U" and "u ∈ U"
shows "(i ∈ {l<⇩a..≤⇩au}) = (i ≤⇩a u ∧ l <⇩a i)"
is ord.greaterThanAtMost_iff.
end
end
context ord_pair_ow
begin
interpretation ord_pair_syntax_ow .
tts_context
tts: (?'a to U⇩a) and (?'b to U⇩b)
sbterms: (‹?le⇩a::?'a⇒?'a⇒bool› to le⇩a) and (‹?le⇩b::?'b⇒?'b⇒bool› to le⇩b)
rewriting ctr_simps
eliminating through (simp add: Type_Simple_Orders.mono_def)
begin
tts_lemma monoD:
assumes "x ∈ U⇩a" and "y ∈ U⇩a" and "mono⇩a⇩b f" and "x ≤⇩a y"
shows "f x ≤⇩b f y"
is ord_pair.monoD.
tts_lemma monoI:
assumes "⋀x y. ⟦x ∈ U⇩a; y ∈ U⇩a; x ≤⇩a y⟧ ⟹ f x ≤⇩b f y"
shows "mono⇩a⇩b f"
is ord_pair.monoI.
tts_lemma monoE:
assumes "x ∈ U⇩a"
and "y ∈ U⇩a"
and "mono⇩a⇩b f"
and "x ≤⇩a y"
and "f x ≤⇩b f y ⟹ thesis"
shows thesis
is ord_pair.monoE.
end
tts_context
tts: (?'a to U⇩a) and (?'b to U⇩b)
sbterms: (‹?ls⇩a::?'a⇒?'a⇒bool› to le⇩a) and (‹?ls⇩b::?'b⇒?'b⇒bool› to le⇩b)
rewriting ctr_simps
eliminating through (simp add: Type_Simple_Orders.mono_def)
begin
tts_lemma strict_monoD:
assumes "x ∈ U⇩a"
and "y ∈ U⇩a"
and "mono⇩a⇩b f"
and "x ≤⇩a y"
shows "f x ≤⇩b f y"
is ord_pair.strict_monoD.
tts_lemma strict_monoI:
assumes "⋀x y. ⟦x ∈ U⇩a; y ∈ U⇩a; x ≤⇩a y⟧ ⟹ f x ≤⇩b f y"
shows "mono⇩a⇩b f"
is ord_pair.strict_monoI.
tts_lemma strict_monoE:
assumes "x ∈ U⇩a"
and "y ∈ U⇩a"
and "mono⇩a⇩b f"
and "x ≤⇩a y"
and "f x ≤⇩b f y ⟹ thesis"
shows thesis
is ord_pair.strict_monoE.
end
end
subsection‹Preorders›
subsubsection‹Definitions and common properties›
locale preorder_ow = ord_ow U le ls
for U :: "'a set" and le ls +
assumes less_le_not_le: "⟦ x ∈ U; y ∈ U ⟧ ⟹ ls x y ⟷ le x y ∧ ¬ (le y x)"
and order_refl[iff]: "x ∈ U ⟹ le x x"
and order_trans: "⟦ x ∈ U; y ∈ U; z ∈ U; le x y; le y z ⟧ ⟹ le x z"
locale preorder_dual_ow = preorder_ow U le ls for U :: "'a set" and le ls
begin
sublocale ord_dual_ow .
sublocale dual: preorder_ow U ge gt
by standard (auto simp: less_le_not_le intro: order_trans)
end
locale ord_preorder_ow =
ord_pair_ow U⇩a le⇩a ls⇩a U⇩b le⇩b ls⇩b + ord⇩b: preorder_ow U⇩b le⇩b ls⇩b
for U⇩a :: "'a set" and le⇩a ls⇩a and U⇩b :: "'b set" and le⇩b ls⇩b
locale ord_preorder_dual_ow = ord_preorder_ow U⇩a le⇩a ls⇩a U⇩b le⇩b ls⇩b
for U⇩a :: "'a set" and le⇩a ls⇩a and U⇩b :: "'b set" and le⇩b ls⇩b
begin
sublocale ord_pair_dual_ow .
sublocale ord_dual: ord_preorder_ow U⇩a ‹(≤⇩a)› ‹(<⇩a)› U⇩b ‹(≥⇩b)› ‹(>⇩b)›
by unfold_locales (auto simp: ord⇩b.less_le_not_le intro: ord⇩b.order_trans)
sublocale dual_ord: ord_preorder_ow U⇩a ‹(≥⇩a)› ‹(>⇩a)› U⇩b ‹(≤⇩b)› ‹(<⇩b)›
by (rule ord_preorder_ow_axioms)
sublocale dual_dual: ord_preorder_ow U⇩a ‹(≥⇩a)› ‹(>⇩a)› U⇩b ‹(≥⇩b)› ‹(>⇩b)›
by (rule ord_dual.ord_preorder_ow_axioms)
end
locale preorder_pair_ow =
ord_preorder_ow U⇩a le⇩a ls⇩a U⇩b le⇩b ls⇩b + ord⇩a: preorder_ow U⇩a le⇩a ls⇩a
for U⇩a :: "'a set" and le⇩a ls⇩a and U⇩b :: "'b set" and le⇩b ls⇩b
begin
sublocale rev: preorder_pair_ow U⇩b le⇩b ls⇩b U⇩a le⇩a ls⇩a ..
end
locale preorder_pair_dual_ow = preorder_pair_ow U⇩a le⇩a ls⇩a U⇩b le⇩b ls⇩b
for U⇩a :: "'a set" and le⇩a ls⇩a and U⇩b :: "'b set" and le⇩b ls⇩b
begin
sublocale ord_preorder_dual_ow ..
sublocale ord_dual: preorder_pair_ow U⇩a ‹(≤⇩a)› ‹(<⇩a)› U⇩b ‹(≥⇩b)› ‹(>⇩b)› ..
sublocale dual_ord: preorder_pair_ow U⇩a ‹(≥⇩a)› ‹(>⇩a)› U⇩b ‹(≤⇩b)› ‹(<⇩b)›
by unfold_locales (auto intro: ord⇩a.order_trans simp: ord⇩a.less_le_not_le)
sublocale dual_dual: preorder_pair_ow U⇩a ‹(≥⇩a)› ‹(>⇩a)› U⇩b ‹(≥⇩b)› ‹(>⇩b)› ..
end
subsubsection‹Transfer rules›
lemma preorder_ow[ud_with]: "preorder = preorder_ow UNIV"
unfolding preorder_def preorder_ow_def by simp
lemma ord_preorder_ow[ud_with]: "ord_preorder = ord_preorder_ow UNIV"
unfolding ord_preorder_def ord_preorder_ow_def ud_with by simp
lemma preorder_pair_ow[ud_with]:
"preorder_pair =
(λle⇩a ls⇩a le⇩b ls⇩b. preorder_pair_ow UNIV le⇩a ls⇩a UNIV le⇩b ls⇩b)"
unfolding preorder_pair_def preorder_pair_ow_def ud_with by simp
context
includes lifting_syntax
begin
lemma preorder_ow_transfer[transfer_rule]:
assumes [transfer_rule]: "right_total A"
shows
"(rel_set A ===> (A ===> A ===> (=)) ===> (A ===> A ===> (=)) ===> (=))
preorder_ow preorder_ow"
by (ow_locale_transfer locale_defs: preorder_ow_def)
lemma ord_preorder_ow_transfer[transfer_rule]:
assumes [transfer_rule]: "right_total A"
shows
"(rel_set A ===> (A ===> A ===> (=)) ===> (A ===> A ===> (=)) ===> (=))
ord_preorder_ow ord_preorder_ow"
by (ow_locale_transfer locale_defs: ord_preorder_ow_def)
lemma preorder_pair_ow_transfer[transfer_rule]:
assumes [transfer_rule]: "right_total A" "right_total B"
shows
"(
rel_set A ===> (A ===> A ===> (=)) ===> (A ===> A ===> (=)) ===>
rel_set B ===> (B ===> B ===> (=)) ===> (B ===> B ===> (=)) ===>
(=)
) preorder_pair_ow preorder_pair_ow"
by (ow_locale_transfer locale_defs: preorder_pair_ow_def)
end
subsubsection‹Relativization›
context preorder_ow
begin
interpretation ord_syntax_ow .
tts_context
tts: (?'a to U)
sbterms: (‹?ls::?'a ⇒ ?'a ⇒ bool› to ls)
and (‹?le::?'a ⇒ ?'a ⇒ bool› to le)
rewriting ctr_simps
substituting preorder_ow_axioms
eliminating through