Theory BL_Chains

section‹BL-chains›

text‹BL-chains generate the variety of BL-algebras, the algebraic counterpart
 of the Basic Fuzzy Logic (see cite"HAJEK1998"). As mentioned in the abstract, this formalization
 is based on the proof for BL-chains found in cite"BUSANICHE2005". We define @{text "BL-chain"} and
 @{text "bounded tower of irreducible hoops"} and formalize the main result on that paper (Theorem 3.4).›

theory BL_Chains
  imports Totally_Ordered_Hoops 

begin

subsection‹Definitions›

locale bl_chain = totally_ordered_hoop + 
  fixes zeroA :: "'a" (0A)
  assumes zero_closed: "0A  A"
  assumes zero_first: "x  A  0A A x"

locale bounded_tower_of_irr_hoops = tower_of_irr_hoops +
  fixes zeroI (0I) 
  fixes zeroS (0S)
  assumes I_zero_closed : "0I  I"
  and zero_first: "i  I  0I I i"
  and first_zero_closed: "0S  UNI 0I"
  and first_bounded: "x  UNI 0I  IMP 0I 0S x = 1S"
begin

abbreviation (uni_zero)
  uni_zero :: "'b set"  (𝔸0I)
  where "𝔸0I  UNI 0I"

abbreviation (imp_zero)
  imp_zero :: "['b, 'b]  'b"  (((_)/ 0I / (_)) [61,61] 60)
  where "x 0I y  IMP 0I x y"

end

context bl_chain
begin

subsection‹First element of @{term I}

definition zeroI :: "'a set" (0I)
  where "0I = π 0A"

lemma I_zero_closed: "0I  I"
  using index_set_def zeroI_def zero_closed by auto

lemma I_has_first_element:
  assumes "i  I" "i  0I"
  shows "0I <I i"
proof -
  have "x A y" if "i <I 0I" "x  i" "y  0I" for x y
    using I_zero_closed assms(1) index_order_strict_def that by fastforce
  then
  have "x A 0A" if "i <I 0I" "x  i" for x
    using classes_not_empty zeroI_def zero_closed that by simp
  moreover
  have "0A A x" if "x  i" for x
    using assms(1) that in_mono indexes_subsets zero_first by meson
  ultimately
  have "x = 0A" if "i <I 0I" "x  i" for x
    using assms(1) indexes_subsets ord_antisymm zero_closed that by blast
  moreover
  have "0A  0I"
    using classes_not_empty zeroI_def zero_closed by simp
  ultimately
  have "i  0I  " if "i <I 0I"
    using assms(1) indexes_not_empty that by force
  moreover
  have "i <I 0I  0I <I i"
    using I_zero_closed assms trichotomy by auto
  ultimately
  show ?thesis
    using I_zero_closed assms(1) indexes_disjoint by auto
qed

subsection‹Main result for BL-chains›

definition zeroS :: "'a" (0S)
  where "0S = 0A"

abbreviation (uniA_zero)
  uniA_zero :: "'a set" ((𝔸0I))
  where "𝔸0I  UNIA 0I"

abbreviation (impA_zero_xy)
  impA_zero_xy :: "['a, 'a]  'a"  (((_)/ 0I / (_)) [61, 61] 60)
  where "x 0I y  IMPA 0I x y"

lemma tower_is_bounded:
  shows "bounded_tower_of_irr_hoops I (≤I) (<I) UNIA MULA IMPA 1S 0I 0S"
proof
  show "0I  I"
    using I_zero_closed by simp
next
  show "0I I i" if "i  I" for i
    using I_has_first_element index_ord_reflex index_order_strict_def that by blast
next
  show "0S  𝔸0I"
    using classes_not_empty universes_def zeroI_def zeroS_def zero_closed by simp
next
  show "0S 0I x = 1S" if "x  𝔸0I" for x
    using I_zero_closed universes_subsets hoop_order_def imp_map_def sum_one_def
          zeroS_def zero_first that
    by simp
qed

lemma ordinal_sum_is_bl_totally_ordered:
  shows "bl_chain A_SUM.sum_univ A_SUM.sum_mult A_SUM.sum_imp 1S 0S"
proof
  show "A_SUM.hoop_order x y  A_SUM.hoop_order y x"
    if "x  A_SUM.sum_univ" "y  A_SUM.sum_univ" for x y
    using ordinal_sum_is_totally_ordered_hoop totally_ordered_hoop.total_order that
    by meson
next
  show "0S  A_SUM.sum_univ"
    using zeroS_def zero_closed by simp
next
  show "A_SUM.hoop_order 0S x" if "x  A_SUM.sum_univ" for x
    using A_SUM.hoop_order_def eq_imp hoop_order_def sum_one_def zeroS_def zero_closed
          zero_first that
    by simp
qed

theorem bl_chain_is_equal_to_ordinal_sum_of_bounded_tower_of_irr_hoops:
  shows eq_universe: "A = A_SUM.sum_univ"
  and eq_mult: "x  A  y  A  x *A y = A_SUM.sum_mult x y"
  and eq_imp: "x  A  y  A  x A y = A_SUM.sum_imp x y"
  and eq_zero: "0A = 0S"
  and eq_one: "1A = 1S"
proof
  show "A  A_SUM.sum_univ"
    by auto
next
  show "A_SUM.sum_univ  A"
    by auto
next
  show "x *A y = A_SUM.sum_mult x y" if "x  A" "y  A" for x y
    using eq_mult that by blast
next
  show "x A y = A_SUM.sum_imp x y" if "x  A" "y  A" for x y
    using eq_imp that by blast
next
  show "0A = 0S"
    using zeroS_def by simp
next
  show "1A = 1S"
    using sum_one_def by simp
qed

end

subsection‹Converse of main result for BL-chains›

context bounded_tower_of_irr_hoops
begin

text‹We show that the converse of the main result holds if @{term "0S  1S"}. If @{term "0S = 1S"}
then the converse may not be true. For example, take a trivial hoop @{text A} and an arbitrary
not bounded Wajsberg hoop @{text B} such that @{text "A ∩ B = {1}"}. The ordinal sum of both hoops is equal to
@{text B} and therefore not bounded.›

proposition ordinal_sum_of_bounded_tower_of_irr_hoops_is_bl_chain:
  assumes "0S  1S" 
  shows "bl_chain S (*S) (→S) 1S 0S"
proof
  show "hoop_order a b  hoop_order b a" if "a  S" "b  S" for a b
  proof -
    from that
    consider (1) "a  S-{1S}" "b  S-{1S}" "floor a = floor b"
      | (2) "a  S-{1S}" "b  S-{1S}" "floor a <I floor b  floor b <I floor a"
      | (3) "a = 1S  b = 1S"
      using floor.cases floor_prop trichotomy by metis
    then
    show ?thesis
    proof(cases)
      case 1
      then
      have "a  𝔸floor a  b  𝔸floor a"
        using "1" floor_prop by metis
      moreover
      have "totally_ordered_hoop (𝔸floor a) (*floor a) (floor a) 1S"
        using "1"(1) family_of_irr_hoops totally_ordered_irreducible_hoop.axioms(1)
              floor_prop
        by meson
      ultimately
      have "a floor a b = 1S  b floor a a = 1S"
        using hoop.hoop_order_def totally_ordered_hoop.total_order
              totally_ordered_hoop_def
        by meson
      moreover
      have "a S b = a floor a b  b S a = b floor a a"
        using "1" by auto
      ultimately
      show ?thesis
        using hoop_order_def by force
    next
      case 2
      then
      show ?thesis
        using sum_imp.simps(2) hoop_order_def by blast
    next
      case 3
      then
      show ?thesis
        using that ord_top by auto
    qed
  qed
next
  show "0S  S"
    using first_zero_closed I_zero_closed sum_subsets by auto
next
  show "hoop_order 0S a" if "a  S" for a 
  proof -
    have zero_dom: "0S  𝔸0I  0S  S-{1S}"
      using I_zero_closed sum_subsets assms first_zero_closed by blast
    moreover
    have "floor 0S I floor x" if "0S  S-{1S}" "x  S-{1S}" for x
      using I_zero_closed floor_prop floor_unique that(2) zero_dom zero_first
      by metis
    ultimately
    have "floor 0S I floor x" if "x  S-{1S}" for x
      using that by blast
    then
    consider (1) "0S  S-{1S}" "a  S-{1S}" "floor 0S = floor a"
      | (2) "0S  S-{1S}" "a  S-{1S}" "floor 0S <I floor a"
      | (3) "a = 1S"
      using a  S floor.cases floor_prop strict_order_equiv_not_converse 
            trichotomy zero_dom
      by metis
    then
    show "hoop_order 0S a"
    proof(cases)
      case 1
      then
      have "0S  𝔸0I  a  𝔸0I"
        using I_zero_closed first_zero_closed floor_prop floor_unique by metis
      then
      have "0S S a = 0S 0I a  0S 0I a = 1S"
        using "1" I_zero_closed sum_imp.simps(1) first_bounded floor_prop floor_unique
        by metis
      then
      show ?thesis
        using hoop_order_def by blast
    next
      case 2
      then
      show ?thesis
        using sum_imp.simps(2,5) hoop_order_def by meson
    next
      case 3
      then
      show ?thesis
        using ord_top zero_dom by auto
    qed
  qed
qed

end

end