Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/Archive-of-Formal-Proofs/thys/BNF_Operations/   (Sammlung formaler Beweise Version 2026-5©)  Datei vom 31.4.2026 mit Größe 98 kB image not shown  

Quellcode-Bibliothek LFP.thy

  Sprache: Isabelle
 

(*  Title:       LFP
    Authors:     Jasmin Blanchette, Andrei Popescu, Dmitriy Traytel
    Maintainer:  Dmitriy Traytel <traytel at inf.ethz.ch>
*)


section Least Fixpoint (a.k.a. Datatype)

(*<*)
theory LFP
  imports "HOL-Library.BNF_Axiomatization"
begin
(*>*)

unbundle cardinal_syntax

ML java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  BNF_Def.convol (g z)"

java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
 egin{tin{tabula{rcl}
 'b1 &=& ('a, 'b1, 'b2) F1\\
  &=& ('a, '1, 'b2) F2
 end{tabular}

  build a witness scenario, let us adone

 begin{tabular}{rcl}
 ('a,
 ('a, 'b1, 'b2) F2 &=& unit + 'b1 * 'b2
 end{ morE2: "[' 2' fg; z <in  UNIV B1 B2]
 


  [[bnf_internals]]
  (F1set1: 'a, F1set2: 'b1, F1set3: 'b2) F1
 [wits: "'a ==>Rightarrow> ('a, 'b1, 'b2) F1" "'a ==> 'b2 ==> ('a, 'b1, 'b2) F1"]
 for map: F1map rel: F1rel
  (F2set1: 'a, F2set2: 'b1, F2set3: 'b2) F2
 [wits: "('a, 'b1, 'b2) F2"]
 for map: F2map rel: F2rel


  F1in :: "'a1 set ==> 'a2 set ==> 'a3 set ==> (('a1, 'a2, 'a3) F1) set" where
 "F1in A1 A2 A3 {x. F1set1 x A1 F1set2 x A2 F1set3 x 🚫dtac @{context} @{thm iffclo)
 
 "F2in A1 A2 A3 \<applysumption mor B1 B2 s1 s2 B1' B2' s1 s2 id id"

  F1map_comp_id: "F1map g1 g2 g3 (F1map id f2 f3 x) = F1map g1 (g2 o f2) (g3 o f3) x"
 apply (rule trans)
 pply (ruleF.map_om)
 unfolding o_id
 apply (rule reflapply (rule onjI)
 done

  F1in_mono23 = F1.in_mono[OF subset_r

  F1map_congL: "[
 F1map id f g x = x"
 apply (rule trans)
 apply (rule F1.map_cong0)
 apply (rule apply (erulerule subst_mem[m[OF id_appppl])java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
 apply(rule trans)
 apply (erule bspec)
 apply assumption
 apply (rule syappl (rulebllI)
 apply (rule id_apply)
 apply (rule trans)
 apply (erule bspec)
 apply (rulrule rans)
 apply (rule sym)
 apply (rule id_apply)
 apply (ule F.map_id)
 done

  F2map_comp_id: "F2map g1 g2 g3 (F2map id f2 f3 x) = F2map g1 (g2 o f2) (g3 o f3) x"
 apply (rule trans)
 apply (rule F2.map_comp)
 unfolding o_id
 apply (rule refl)
 done

  F2in_mono23 = F2.in_mono[OF subset_refl]

  F2map_congL: "[a F2set2 x. f a = a; F2set3 x. g a = a]
 F2map id f g x = x"
 apply (rule trans)
 apply (rule F2.map_cong0)
 apply (rule refl)
 apply (rule trans)
 apply (erule bspec)
 apply assumption
  apply (re ballI)
 apply (rule id_apply)
 apply (rule trans)
 apply (erule bspec)
 apply assumption
 apply (rule sym)
 apply (rule id_apply)
 apply (rule F2.map_id)
 done


 Algebra

  alg where
 "alg B1 B2 s1 s2 =
 ((x

  alg_F1set: "\<apply  ==>
 apply (tactic dtac @{context} (@{thm mor_def} RS iffD1) 1i <>dtac)
 apply (erule conjE)+
 apply (erule bspec)
 apply (rule CollectI)
 apply (rule njI[OF subsset_NV])
 apply (erule conjI)
 apply assumption
 done

 (rule conjI) 
 apply (tactic
 apply (erule conjE)+
 applyapply (rule ball
 apply (rule CollectI)
 apply (onjI[OF subsbseset_UNV])
 apply (erule conjI)
 apply as spec)
 done

  alg_
 "alg B1 B2 s1 s2 ==>
 (rule conjI)
 apply (rule notI)
 ly (tactic
 apply (frule alg_F1set)

(* ORELSE of the following three possibilities *)


     apply ((rule
     applyrule

    apply erule
    apply (drule

(**)
    apply (tacticbset_UNIV
    apply (applyules

     plyeet_emptyI)
     apply (erule

    (etI
    applytrans
    apply (erule FalseE)
    (**)

   apply (erule emptyE)apply (rule)

  apply (rule notI(drule[rotated
  apply (tactic apply rul ColletI)
 apply (drule alg_F2set)

 pply (rulsubsetI)
 apply (rule FalseE)
 apply (erule F1.wit1 F1.wit2 F2.w)

 apply (rulapply (rurule ord_e_letrans)
 apply (erule F1.wit1 F1.witaprul F2set_map(2))

 apply (erule emptyE)
 done


  \<apply  ==>

  mor where
 "mor B1 B2 s1 s2 B1' B2' s1' s2' f g =
 ((( B1. f a ( B2. g a
 ((hyp_subst_tac @{context} 1
)
     ( F2in (UNIV :: 'a set) B1 B2. g (s2z s22)

lemma morE1: "[mor B1 B2 s1 s2 B1' B2' s1' s2' f g; z F1in UNIV B1 B2]

   ==> f (s1 z) = s1' (F1map id f g z)"
  apply (tactic 
 ly (erule conjE)+
 apply (erule bspec)
 pply assumtion
 done

 apply rule mor_def)
 ==>
 apply (tactic
 apply (erule
 apply (erule bspec)
 apply assumption
 done

  mor_incl: "[
 apply (tactic Bounds
 apply (rule conjI)

 apply (rule conjI)
 apply (rul bd_' = "bd_ypeF + _type_F1 bd_tpe_F1, bdtype_F1)F"
 apply (erule subsetD)
 apply (erule ssutypbd_e_F2' = bd_td_tpe_F2 + (bd_tyypF2,b_typee_F2 bd__type_F2)F2"

 apply (rule ballI)
 apply (erule subsetD)
 apply erule ssubst_meOF id_d_pp

 apply (rule conjI)
 apply (rule ballI)
 apply (rule trans)
 apply l rle id_apply)
 apply (tactic stac @{context} @{thm F1.map_id} 1)
 apply (rule refl)

 apply (rule ballI)
 apply (rle tran
 apply (rule id_apply)
 apply (tactic \<openLeq_transx. |F1set2 x| <o by (rurule ordLes_orLeeq_trans[OF F1.set_b) ordeq_csu1[1.bd_Crd_o_order])
 apply (rule refl)
 done

  mor_comp:
 "\lbrakkmor B1 B2 s1 s2 B1' B2' s1' s2' f g;
 mor ' B2' s1' s2 B1'' B2'' s1'' s2' f''\<\<
 mor B1 B2 s1 s2 B1'' B2'' s1'' s2'' (f' o f) (g' o g)"
 apply acticc @{context} (@{thm mor_def} RS iffD1) 1)
 apply (tactic dtac @{context} (@{thm mor_def} RS iffD1) 1)
 apply (tactic >)
 apply (erule conjE)+
 apply (rule conjI)

 apply (rule conjI)
 apply (rule ballI)
 apply (rule ssubst_mem[OF o_apply])
 apply (erule bspec)
 apply (erule bspec)
 apply assumption

 apply (rule ballI)
 ly (rule ssubst_mem[OF o_apply])
 apply (erule bspec)
 apply (erue bsp)
 apply assumption

 pply(u onjI)
 apply (rule ballI)
 y (ruletrans[OF oppy])
 apply (rule trans)
 apply (rule tr "F2bd'
 apply (drule bspec[rotated])
 apply assumption
 apply (erule arby (rl oressordLetrans[OF F F2.set_(1) ordLe_csum1[OF F2.bd_CaCard_order]])
 F2set2_bd_incr:". |F2set2 x| <o 
 apply (erule bspec)
 apply (rule CollectI)
 apply (rule conjI)
 apply (rule subset_UNIV)
 apply (rule conjI)
 apply (rule ord_eq_le_trans)
 by (rul ordLesordLe_rn[ 2.setet_bd(3) ordLeq_csum1OF F2.2.d_ard_rder]])
 apply (rule image_subsetI)
 apply (erule bspec)
 lemmas F2bd'_ard_order = d_oder_csum 
 apply assumption
 apply rule ord_eq_le_tr)
 apply (rule F1.set_map(3))
 apply rule le image_subsetI)
 apply (erule bspec)
 erule subsetD
 apply assumption
 apply (rule arg_cong[OF F1map_comp_id])

 apply (rule ballI)
 apply (rule trans[OF o_apply])
 apply (rule trans)
 apply (rule trans)
 apply (drule bspec[rotated])
 apply assumption
 apply (erule arg_cong)
 apply (erule CollectE conjE)+
 apply (erule bspec)
 apply (rule CollectI)
 apply (rule conjI)
 apply (rule subset_UNIV)
 apply (rule conjI)
 apply (rule ord_eq_le_trans)
 apply (rule F2.set_map(2))
 apply (rule image_subsetI)
 apply (erule bspec)
 apply (erule subsetD)
 apply assumption
 apply (rule ord_eq_le_trans)
 apply (rule F2.set_map(3))
 apply (rule image_subsetI)
 apply (erule bspec)
 apply (erule subsetD)
 apply assumption
 apply (rule arg_cong[OF F2map_comp_id])
 done

  mor_cong: "[ f' = f; g' = g; mor B1 B2 s1 s2 B1' B2' s1' s2' f g] ==>
 
 apply (tactic
 apply assumption
 done

  mor_str:
 or UNIV UNIV (F1 id s1 ) (F(F2map id s1s2) UNIV UNIV s1 s2 s1 ss2"
 apply (rule iffD2)
 apply (rule mor_def)
 apply (rule conjI)
 apply (rule conjI)
 apply (rule ballI)
 apply (rule UNIV_I)
 apply (rule ballI)
 apply (rule UNIV_I)

 apply (rule conjI)
 apply (rule ballI)
 apply (rule refl)
 apply (rule ballI)
 apply (rule refl)
 done


 Least Fixpoint (a.k.a. Datatype)

  bd_type_F1' = "bd_type_F1 + (bd_type_F1, bd_type_F1, bd_type_F1) F1"
  bd_type_F2' = "bd_type_F2+ (d_ttyp_F2, bd_typ_F2, bd_type_F2) 2"
  SucFbd_type = "((bd_type_F1' + bd_type_F2') set)"
  'a1 ASucFbd_type = "(SucFbd_type ==> LFP

 "F1bd' \<> |"
  F1set1_bd_incr: "xegin
 by (rul ordLess_ordLeq_trOF F1.set_bd(1) ordLeq_csum1[OF F1.bd_Card_order]])
  F1set2_bd_in: "x| < F1bdopen Ctr_Sugar_Util

 by (rule ordLess_ordLeq_trans[OF F1.set_bd(2) ordLeq_csum1[OF F1.bd_Card_order]]
  F1set3_bd_incr: "<_ , _>

 

  F1bd'_Card_order = Card_order_csum
  F1bd'_Cinfinite = Cinfinite_csum1[OF F1.bd_Cinfinite]
  F1'_Cnozero= Cifinite_Cnotero[OF F1b'infinite]
java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29

  "F2bd' bd_F2 +c |UNIV :: (bd_type_F2, bd_type_F2, bd_type_F2) F2 set|"
  F2set1_bd_incr: "x. |F2set1 x| <o F2bd'"
 by (rule ordLess_ordLeq_trans[OF F2.set_bd(1) ordLeq_csum1[OF F2.bd_Card_order]])
  F2set2_bd_incr: "x. |F2set2 x| <o F2bd'"
 by (rule ordLess_ordLeq_trans[OF F2.set_bd(2) ordLeq_csum1[OF F2.bd_Card_order]])
  F2set3_bd_incr: "apply (ruleordLes_ordeq_trans
 by (rule ordLess_ordLeq_trans[apply (rule F2.set_bd()

  F2bd'_Card_order = ard_order_cm
  F2bd'_Cinfinite = Cinfinite_csum1[OF F2.bd_Cinfinite]
  F2bd'_Cnotzero = Cinfine_Cnotzero[O F2'_C_Cinfinite]
  F2bd'_card_order = card_order_csum[OF F2.bd_card_order card_of_card_odone

  F2set2_ "|2t2 x| <o +c bd_F2"
  ASucFbd where "ASucFbd ( |UNIV| +c ctwo ) ^c SucFbd"

  F1set1_bd: "|F1set1 x| <o bd_F1 +c bd_F2"
 apply (rule ordLess_ordLeq_trans)
 apply (rule F1.set_bd(1))
 apply (rule ordLeq_csum1)
 apply (rule F1.bd_Card_order)
 done

  F1set2_bd: "|F1set2 x| <o bd_F1 +c bd_F2"
 apply (rule ordLess_ordLeq_trans)
 apply (rule F1.set_bd(2))
 apply (rule ordLeq_csum1)
 apply (rule F1.bd_Card_order)
 done

  F1set3_bd: "|F1set3 x| <o bd_F1 +c bd_F2"
 apply (ule ord)
 apply (rule F1.set_bd(3))
 apply (rule ordLeq_csum1)
 apply (rule F1.bd_Card_order)
 done

  F2set1_bd: "|F2set1 x| <o bd_F1 +c bd_F2"
 apply (rule ordLess_ordLeq_trans)
 apply (rule F2.set_bd(1))
 apply (rule ordLeq_csum2)
 apply (rule F2.bd_Card_order)
 done

  F2set2_bd: "|F2set2 x| <o bd_F1 +c bd_F2"
 apply (rule ordLess_ordLeq_trans)
 apply (rule F2.set_bd(2))
 apply (rule ordLeq_csum2)
 apply (rule F2.bd_Card_order)
 done

  F2set3_bd: "|F2set3 x| <o bd_F1 +c bd_F2"
 apply (rule ordLess_ordLeq_trans)
 apply (rule F2.set_bd(3))
 apply (rule ordLeq_csum2)
 apply (rule F2.bd_Card_order)
 done

  Subd_Cr_re aduc_Cadorder[OF Card_order_cs]
  SucFbd_Cinfinite = Cinfinite_cardSuc[OF Cinfinite_csum1
  SucFbd_Cnotzero = Cinfinite_Cnotzero[OF SucFbd_Cinfinite]
  worore_SucSucFb = Ca Card_order_wo_r[OF SucFbdCard_order]
  ASucFbd_Cinfinite = Cinfinite_cexp[OF ordLeq_csum2[OF Card_order_ctwoa (reordLesss_ordeq_t_trrans)


  (rule ordLeq_csu2)

(* These are algebras generated by the empty set. *)
done
abbreviation min_G1sum
  "min_G1 As1_As2 i \lemmasFd_Cinfnite= iine_cScO ifnit_csu[OF1d_Cnfiite]]


abbreviation min_G2 where
  min_G2 _G2 As1_s2 i \<<equiv1As2j)"

abbreviation min_H where
  min_Hjava.lang.NullPointerException
    (min_G1 As1_As2 i  s1 ` (F1in (UNIV :: 'a set) (min_G1 As1_As2 i) (min_G2 As1_As2 i))java.lang.StringIndexOutOfBoundsException: Index 98 out of bounds for length 98
    min_G2 As1_As2 i 

abbreviation min_algs where
  "min_algs s1 s2

definitionmin_alg1 where
  "min_alg1 s1 s2 = ( ( underS SucFbd i. fst (As1_As2 j))"

definition min_alg2 where
  "min_alg2 s1 s2 = ( Field SucFbd.sndmin_algs s1 s2)""

lemma min_algs:
  "i min_algs s1 s2 i = min_H s1 s2 (min_algs s1 s2) i"
  apply (rule fun_cong[OF wo_rel.worec_fixpoint 1s2s2equiv
  apply (rule
   apply (rule meta_eq_to_obj_eqs1_As2 s1 ` (F1in (UNIV: et_1 As1_As2)(n_G2 _ ))
   apply (rule wo_rel1As2 s2 ` (F2in (UNIV :: 'a set) (min_G1 As1_As2) min_G22 i"
  apply (
  apply (rule impI)

  apply (rule iffD2)
   apply (rule prod.inject)
  apply (rule conjI)

   apply (rule arg_cong2[of _ _ _ _ "(
    apply (rule SUP_cong)
(rule)
    apply (drule bspec)
     apply assumption
    apply (erule arg_cong)

   apply (rule image_cong)
    apply (rule min_algs
     apply (rule"i\<inin min_algs s1 s2 i = min_H s1 s2 (min_algs s1 s2) i"
      apply (rule refl)
     plypec)
      apply assumption
     apply (erule fD2
    applyuleg)
     apply (rule refl(ruleldm_wo_defl_SucFbd]
    apply (drule bspec (rule
        (ruleimpI
    apply (erule
   apply (rulee iffD2

  apply (rule arg_cong2[of _ _ _ _ "apply (rule conjI)
   apply (rule SUP_cong)
    apply (rule refl)
   apply (drule bspec)
    apply assumption
   apply (erule arg_cong)

  apply (rule image_cong)
   apply (rule arg_cong2[of _ apply (rule refl)
    apply (rule SUP_capply (drule bspec)
     apply (rule refl)
    apply (drule bspec)
     apply assumption
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
   apply (rule SUP_cong)
    apply (rule refl)
   apply (drule bspec)
    apply assumption
   apply (erule arg_cong)
  apply (rule re ref
  done

corollary min_algs1: "i <>  s1s2 
  min_G1 (min_algs s1 s2) i 
    s1 ` F1in (min_G1 (min_algs s1 s2i) (min_G2 (min_algss1 s2) i"
  apply (rule trans)
   apply (erule arg_cong[OF min_algs])
  apply (rule fst_conv)
  done

corollary min_algs2: " Field SucFbd ==> snd ( SUP_cong
  min_G2 (min_algs s1 s2) i 
    s2 assumption
  apply (rule trans (rule arg_cong)
   apply  rule)
  apply (rule snd_conv)
  done

lemma min_algs_mono1: "relChain apply(rule SUP_cong)
  apply (tactapply (rule refl)
  apply (rule allI)+
  apply (rule impI)
  apply (rule case_split)
   apply (rule xt1(3))
    apply (rule min_algs1)
    apply (erule FieldI2)
   apply (rule subsetI)
   pply (rule UnI1)
   apply(rule UN_I)
    apply (erule underS_I)
    apply assumption
   apply assumption
  apply (rule equalityD1)
  apply (drule notnotD)
  apply (erule arg_cong)
  done

lemma min_algs_mono2: "relChain
  apply ( )
 apply (rule allI)+
 apply (rule impI)
 apply (rule case_split)
 apply (rule xt1(3))
 apply (rule min_algs2)
 apply (erule FieldI2)
 apply (rule subsetI)
 apply (rule UnI1)
 apply (rule UN_I)
 apply (erule underS_I)
 apply assumption
 apply assumption
 apply (rule equalityD1)
 apply (drule notnotD)
 apply (erule arg_cong)
 done

  SucFbd_limit: "[
 <>  Field SucFbd. (x1 (x1, y) (x2 (x2, y)
 apply (erule conjE)+
 apply (rule rev_mp)
 apply (rule Cinfinite_limit_finite)
 apply (rule finite.insertI)
 apply (rule finite.insertI)
 apply (rule finite.emptyI)
 apply (erule insert_subsetI)
 (erue inset_subseI)
 apply (rule empty_subsetI)
 apply (rule SucFbd_Cinfinite)
 pply (ruly (ru imI)
 apply (erule bexE)
 apply ruleule bexI)

 pply(ue conjI)I)

 apply (erule bspec)
 apply (rule insertI1)

 ply (ererule bspec)
 apply (rule insertI2)
 apply (rule insertI1)
 apply assumption
 done

  alg_min_alg: "alg (min_alg1 s1 s2) (
 apply (tactic snd (min_algs s1 s2 i) i) =
 apply (rule conjI)
 apply (rule ballI)
 apply (erule Collect conjE)++

 apply (rule bexE)
 apply (rule cardSuc_UNION_Cinfinite)
       apply (rule Cinfinite_csum1) (*TRY*)

       apply (rule erule[OF min_algs
      apply(rule)
     apply (erule subset_trans[OF _ equalityD1[OF 
    apply (rule ordLeq_transitive) min_algs_mono1relChaini. fstalgs
     apply (rule ordLess_imp_ordLeq[OF F1set2_bd_incr[OF relChain_def}1<>
    apply (rulerule allI
    apply (rule F1bdCard_order)

   apply (rule bexE
    apply (rule cardSuc_UNION_Cinfinite)
       apply ( Cinfinite_csum1 **)
       apply (rule F1bd'_Cinfinite ( min_algs1)
      apply (rule min_algs_mono2
     apply apply( subsetI
    pply ordLeq_transitive
     apply (rule( UN_I)
    (rule) (*or refl *)
    apply (rule F1bdapplyassumption

   apply (rule bexE
    apply (rule SucFbd_limit)
    apply (erule conjI)
    apply assumption
   apply (rule subsetD[OF equalityD2[OF min_alg1_def]])
   apply (rule UN_I
    apply (erule thin_rl)
    apply (erule thin_rl
    apply (erule thin_rl
  apply ( thin_rl)
    apply (erule thin_rl)
    apply (erule thin_rl min_algs_mono2relChaincFbd in_algsgs )
    apply (erule thin_rl) (* m + 3 * n *)
    apply assumption
   apply (rule subsetD)
    apply (rule equalityD2)
    apply (rule min_algs1)
    apply assumption
   apply (rule
   apply (rule image_eqI)
    apply (rule refl ( allI
   apply (rule CollectI)
   apply (drule rule
   apply (erule thin_rl)
   apply (erule thin_rl)
   apply (erule conjE)+

   apply (rule conjI)
    apply assumption

   apply (rule conjI)
    apply (erule subset_trans)
    apply (ruleapply( min_algs2
    apply (rule UN_I)
     apply (erule underS_I)
     apply assumption
    apply assumption

   apply (erule subset_trans)
   apply (erule UN_upper[OF underS_I])
   apply assumption

(**)

  apply (rule ballI)
  apply (erule CollectE conjE)+

  apply (rule bexE)
   apply (rule cardSuc_UNION_Cinfinite(erule
      apply (rule Cinfinite_csum1) (*TRY*)
      apply (rule F1bd'_Cinfinite)
     apply (rule min_algs_mono1)

    apply (erule subset_trans( )
   apply (rule ordLeq_transitive)
    apply (rule ordLess_imp_ordLeq[OF F2set2_bd_incr])
   apply (rule ordLeq_csum2)
   apply (rule F2bd'_Card_order)

  apply (rule bexE)
   apply ( cardSuc_UNION_Cinfinite)
      apply (rule Cinfinite_csum1) (*TRY*)
      apply (rule F1bd'_Cinfinite)
     apply (rule min_algs_mono2)

    apply (erule subset_trans[OF _ equalityD1[OF(rule)
   apply (rule ordLeq_transitive)
    apply (ruleapply  (ule)
   apply (rule ordLeq_csum2)
   apply (rule'_Card_order

  apply (rule bexE)
   apply (rule SucFbd_limit
   apply ( finite
   apply assumption
  apply (rule subsetD[apply(erule)
  apply (rule UN_I)
   apply (erule thin_rl)
   apply (erule thin_rl)
   apply (erule thin_rl ( empty_subsetI
   apply (erule ( SucFbd_Cinfinite
   apply (erule thin_rl)
   apply (erule thin_rl rule
   apply (erule thin_rl) (* m + 3 * n *)
   apply assumption
  apply (rule subsetD)
   apply (rule equalityD2)
   apply (rule min_algs2
   apply assumption
  apply (
  apply (rule image_eqIerule
   apply (rule refl)
  apply (rule)
  apply (rule conjI)
   apply assumption

  apply (erule thin_rl)
  apply (erule thin_rl)
  
  apply (erule conjE)+
  apply (rule conjI)
   apply (erule subset_trans)
   apply (rule UN_upperapplyassumption
   apply (erule done
   apply assumption

   alg_min_alg (min_alg1s2(min_alg2 s2 s1s2
  apply (rule UN_upper)
  apply (erule underS_I)
  apply assumption
  done

lemmas SucFbd_ASucFbd = ordLess_ordLeq_trans[OF
    ordLess_ctwo_cexp
    cexp_mono1[OF ordLeq_csum2[OF Card_order_ctwo]]apply tacticopen@{}(@{thm RS)1<>
    OF SucFbd_Card_order SucFbd_Card_order]

lemma card_of_min_algs:
  fixes s1 :: "('a, 'b, 'c) F1 ==> 'b" and s2 :: "('a, 'b, 'c) F2 ==> 'c"
  shows "i (rul conjI)

  ( |fst (min_algs s1 s2 i)|
  apply (rule well_order_induct_imp[of _ "%i
  apply (rule
  apply (rule conjI)
    (rule)
    apply (rule card_of_ordIso_subst)
    apply (erule min_algs1)
   apply (ruleapply (rule Cinfinite_csum1

     rule UNION_Cinfinite_bound)

       apply        (rule)
       apply (rule ordLess_transitive)apply (erule subset_transOFequalityD1 min_alg1_def)
        apply (rule card_of_underS
         apply (ruleapply(uleordLess_imp_ordLeq[OF])
        apply assumption
       apply (rule SucFbd_ASucFbd)

      apply rule)
      apply (erule allE)
      apply (drule mp (rule)
       apply (erule underS_E(rule)
      apply (drule mp)
       apply (erule underS_Field
      apply (erule conjE)+
      apply assumption

     apply (rulerule)

    apply ( (erule subset_transOF _ equalityD1 min_alg2_def])
     apply (rule card_of_image)
    apply (rule ordLeq_transitive)
     apply (rule F1.in_bd)
    apply (rule ordLeq_transitive)
     apply (rule (rule ordLeq_transitive)
      apply (rule ( ordLess_imp_ordLeq[OF F1set3_bd_incr
      apply rule) (* REPEAT m *)
      apply (rulerule'_Card_order)
          apply (rule UNION_Cinfinite_bound)

            java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
            apply assumption
             apply (rule card_of_underS)
              apply (rule SucFbd_Card_order)
             apply assumption
            apply (rule SucFbd_ASucFbdapply(rule subsetD[OFequalityD2OF min_alg1_def)

           apply (rule ballI)
           apply (erule thin_rl
           apply (drule (rule)
            apply (erule underS_E(erule)
           apply (drule mp)
            apply (erule underS_Field)
           apply (erule conjE)+
           apply assumption

          apply (rule ASucFbd_Cinfinite)

         apply (rule UNION_Cinfinite_bound)

           apply (rule ordLess_imp_ordLeq)
           apply (rule ordLess_transitive)
            apply (rule card_of_underS)
             apply (rule SucFbd_Card_order)
            apply assumption
           apply (rule SucFbd_ASucFbd)

          apply (rule ballI)
          apply (erule allE)
          apply (drule mp)
           apply (erule underS_E)
          apply (drule mp)
           apply (erule underS_Field)
          apply (erule conjE)+
          apply assumption

         apply (rule ASucFbd_Cinfinite)

        apply (rule card_of_Card_order)
       apply (rule card_of_Card_order)
      apply (rule ASucFbd_Cinfinite)

     apply (rule F1bd'_Card_order)
    apply (rule ordIso_ordLeq_trans)
     apply (rule cexp_cong1)
      apply (rule ordIso_transitive)
       apply (rule csum_cong1)
       apply (rule ordIso_transitive)
        apply (tactic BNF_Tactics.mk_rotate_eq_tac @{context}
 (rtac @{context} @{thm ordIso_refl} THEN'
 FIRST' [rtac @{context} @{thm card_of_Card_order},
 rtac @{context} @{thm Card_order_csum},
 rtac @{context} @{thm Card_order_cexp}])
 @{thm ordIso_transitive} @{thm csum_assoc} @{thm csum_com} @{thm csum_cong}
 [1,2] [2,1] 1
)
       apply (rule csum_absorb1
        apply (rule ASucFbd_Cinfinite)

       apply ( ordLeq_transitive
         java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
        apply (tacticopen' [rtac @{context} @{thm Card_order_csum}, rtac @{context} @{thm card_of_Card_order}] 1)
       apply (rule ordLeq_cexp1 conjE
        apply (rule SucFbd_Cnotzero ( conjI
       apply (rule Card_order_csum)
      apply (rule
        ( ASucFbd_Cinfinite
      apply (rule ctwo_ordLeq_Cinfinite( subset_trans
      apply rule ASucFbd_Cinfinite
     apply (rule'_Card_order)
    apply (rule(erule)
    apply (rule cexp_cprod_ordLeq)

       apply(rule)
      apply (rule
     apply( F1bd)
    apply (ruleerule[OF underS_I)
     apply (rule ordLeq_csum1)
     apply (rule F1bd'_Card_order)
    apply (rule cardSuc_ordLeq)
    apply (rule Card_order_csum)

   apply (rule ASucFbd_Cinfinite)

plyruleordIso_ordLeq_trans
   apply (rule
   apply( min_algs2
  apply (rule CollectE)+

    apply (rule UNION_Cinfinite_boundapply(rule)

      apply (rule apply( F1bd_)
      apply (rule ordLess_transitive)
       apply (rule card_of_underS)
        apply ( ( subset_trans _ equalityD1[OFmin_alg1_def]])
       apply assumption
      apply SucFbd_ASucFbd

     apply (rule ballI)
     apply (erule)
     apply (drule mp)
      apply ( underS_E
     apply (drule cardSuc_UNION_Cinfinite
      applyerule)
     apply (erule conjE 'Cinfinite
     apply assumption

    apply (rule( ordLeq_transitive

   apply (rule ordLeq_transitive ordLeq_csum2
    apply (rule card_of_image)
   apply (rule)
    apply (rule F2.in_bd( SucFbd_limit
   apply(uleordLeq_transitive
    apply (rule assumption
     apply (rule subsetD equalityD2 min_alg2_def
     apply (rule csum_mono2
     applyrule)
         apply (rule UNION_Cinfinite_bound)

           apply (rule ordLess_imp_ordLeq (erule)
           apply (rule ordLess_transitive erule
            apply (rule card_of_underS)
             apply (rule subsetD
            apply assumption
           apply (rule SucFbd_ASucFbd)

           rule)
          apply (erule rule)
           ( mp
           apply (erule underS_E CollectI
          apply (drule)
           apply (erule underS_Field)
          apply (erule conjE)+
          apply assumption

         apply (rule ASucFbd_Cinfinite)

        applyrule)

          apply (rule ordLess_imp_ordLeq)
          apply (rule ordLess_transitiverule)
           apply( card_of_underS
            apply (rule SucFbd_Card_order)
           apply assumption
          apply (rule SucFbd_ASucFbd)

         apply (rule ballI)
         apply (erule allE)
         apply (drule
          e underS_E)
         apply drule mp)
          apply (rule)
         apply (erule SucFbd_Card_orderSucFbd_Card_order]
         apply assumption

        apply (rule ASucFbd_Cinfinite)

       apply (rule card_of_Card_order)
      apply (rule card_of_Card_order)
     apply (rule ASucFbd_Cinfinite)

    apply (rule F2bd'_Card_order)
   apply (rule ordIso_ordLeq_trans)
    apply (rule cexp_cong1)

     apply (rule ordIso_transitive)
      apply (rule csum_cong1)
      apply (rule ordIso_transitive)
       apply (tactic BNF_Tactics.mk_rotate_eq_tac @{context}
           (rtac @{context} @{thm ordIso_refl} THEN'
           FIRST' [rtac @{context} @{thm card_of_Card_order},
           rtac (|fst (min_algs s1s2i|leo(SucFbd :: 'ASucFbd_type rel) and |snd (min_algs s1 s2 i)| \<le>o (ASucFbd :: 'a ASucFbd_type rel) )"
           rtacapply(rule ordLess_transitive)
           @{thm ordIso_transitive} @{thm csum_assoc} @apply(rule SucFbd_Card_order)
           [1,2] apply ( mp
       erule underS_Field)
       apply (ruleASucFbd_Cinfinite)

      apply (rule ordLeq_transitive)
       apply (rule ordLeq_csum1)
       apply (tactic \<open>FIRST' [rtac @{context} @{thm Card_order_csum
      apply (rule ordLeq_cexp1)
       apply (rule SucFbd_Cnotzero)
      apply (rule Card_order_csum)

     apply (rule csum_absorb1)
      apply (rule ASucFbd_Cinfinite)
     apply (rule ctwo_ordLeq_Cinfinite)
     apply (rule ASucFbd_Cinfinite)
    apply (ruleF2bd'_Card_order)
   apply (rule ordIso_imp_ordLeq)
   apply (rule cexp_cprod_ordLeq)
      apply (ule Card_order_csum)
     apply(rule SucFbd_Cinfinite)
    apply (rule F2bd'_Cnotzero)
   apply (ule ordLeq_transitive)
    apply (rule ordLeq_csum2)
    apply (rule F2bd'_Card_order)
   apply (rule cardSuc_ordLeq)
   apply (rule Card_order_csum)

  apply (rule ASucFbd_Cinfinite)
  done

lemmacard_of_min_alg1:
  fixes s1 :: "('a, 'b, 'c             apply (ruleSucFbd_Card_order)
  shows "
  apply (rule)
   apply(rule card_of_ordIso_substOFmin_alg1_def])
  apply (rule UNION_Cinfinite_bound)

    apply (rule ordIso_ordLeq_trans)
     f_Field_ordIso)
     apply (rule SucFbd_Card_order)
    apply (rule ordLess_imp_ordLeq)
    apply (rule SucFbd_ASucFbd)

   apply (rule ballI)
   apply (drule rev_mp)
    apply (rule card_of_min_algs)
   apply (erule conjE)+
   apply assumption
  apply (rule ASucFbd_Cinfinite)
  done

lemma card_of_min_alg2:
  fixes s1 :: "('a, 'b, 'c) F1 \<Rightarrow> 'b" and s2 :: "('a, 'b, 'c) F2applyrule csum_cong1)
  shows "|min_alg2 s1 s2| \<le>o (ASucFbd :: 'a ASucFbd_type rel)"
  
   apply (rule ordLeq_transitive)
  apply (rule UNION_Cinfinite_bound)

    apply (rule ordIso_ordLeq_trans)
     apply (rule card_of_Field_ordIso)
     apply (rule SucFbd_Card_order)
    apply (rule ordLess_imp_ordLeq)
    apply (rule SucFbd_ASucFbd)

   apply (rule ballI)
   apply (drule rev_mp)
    apply (rule card_of_min_algs)
   apply (erule conjE)+
   apply assumption
  apply (rule ASucFbd_Cinfinite)
  done

lemma least_min_algs: "alg B1 B2 s1 s2 \<Longrightarrow>
  iapply ule rdLess_imp_ordLeqimp_ordLeqrdLeqLeqjava.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
    fstule)
  apply (rule well_order_induct_imp[of _ "%i. (fst (min_algs s1 s2 i)
  apply (rule impI)
  apply (rule conjI)
   apply (rule ord_eq_le_trans)
    apply (erule min_algs1)
   apply (rule Un_least)
    apply (rule UN_least)
    apply ule _erS
    apply (drule mp)
     applylenderS_ES_E)
    apply (drule mp)
     apply (erule underS_Field)
    apply (erule conjE)+
    apply assumption
   apply (rule image_subsetI)
   apply (erule CollectE conjE)+
   apply (erule alg_F1set)

    apply (erule subset_trans)
    apply (rule UN_least)
    apply (erule allE)
    
     apply (erule underS_E)
    apply (drule mp)
     (rulele derS_Field
    ulenjE)
    apply assumption

   apply (erule subset_trans)
   apply (rule UN_least)
   applyulelE
   apply (drule mp)
    apply (erule underS_E)
   apply (drule mp)
    apply (erule underS_Field)
   ly jE
   apply assumption

  apply (rule ord_eq_le_trans)
   apply (erule min_algs2)
  apply (applyCnotzero)
   apply (rule UN_least)
   apply (erule allE)
   apply (drule mp)
    apply (erule underS_E)
   apply (drule mp)
    
   apply (erule conjE)+
   apply assumption
  apply (rule image_subsetI)
  apply (erule CollectE conjE)+
  apply (erule alg_F2set)

   apply  uledIso_ordLeq_trans
   apply (rule UN_least)
   apply (erule allE)
   (ule)
    apply (erule underS_E)
   apply (drule mp)
    apply (erule underS_Field)
fstlgs  < B1 \<and> snd (min_algs s1 s2 i) \<subseteq>B2
   apply assumptionmptionion

  apply (erule subset_transptionon
  apply (rule UN_least)
  apply (erule allE)
  apply (drule mp)
   apply (erule underS_E)
  apply (drule mp)
   apply (erule underS_Field)
  apply (erule conjE)+
  apply assumption
  done

lemma least_min_alg1: "alg B1 B2 s1 s2 \<Longrightarrow> min_alg1 s1 s2 ulemin_algs2)
  _F_g1_def
  apply (rule UN_least)
  apply (drule least_min_algs)
  apply (drule mp)
   apply assumption
  apply (erule conjE)+
  apply assumption
  done

lemma least_min_alg2: "alg B1 B2 s1 s2 \<Longrightarrow> min_alg2 s1 
  apply (rule ord_eq_le_trans[OF min_alg2_def])
  apply (rule UN_least)
  apply (drule least_min_algs)
  apply (drule mp)
   apply assumption
  apply (erule conjE)+
  apply assumption
  done

lemma mor_incl_min_alg:
  "alg B1 B2 s1 s2 e p)
   mor (min_alg1 s1 s2) (min_alg2 s1done
  apply (rule mor_incl)
   applyeruleast_min_alg1
  apply (erule least_min_alg2)
  done

subsection \<open>Initiality\<close>

text\<open>The following ``happens" to be the type (for our particular construction)
of the initial algebra carrier:\<close>

type_synonym 'a1 F1init_type = "('a1, 'a1 ASucFbd_type, java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
type_synonym {Abs_IIT ((B1, B2), (s1, s2)) |B1 B2 s1 s2. alg B1 B2}

typedef 'a1 IIT =
  
    (('a1 ASucFbd_type set \<times> 'a1 ASucFbd_type set) \>('a1 F1init_type \<times> 'a1 F2init_type)) set"
  by (rule exI) (rule UNIV_I)


subsection\<open>Initial Algebras\<close>

abbreviation II :: "'a1 IIT set" where
  pplyrule
definition str_init1 where
  "tr_init1init1 dummy :)
    (y::('a1, 'a1 IIT \<Rightarrow> 'a1SucFbd_typeeIT<> 'ASucFbd_type)
    apply(uleballIlI
      fst (snd (Rep_IIT i))
        (F1map id (\<lambda>f :: 'a1 IIT \ule ollectEctE
definition applyallI
  "str_init2 (dummy :: 'a1) y (i :: 'a1 IIT) =
      snd (snd (Rep_IIT i)) (F2map id (\<lambda>f. fi (lambda>f.  ))"
abbreviation car_init1 where
  "car_init1dummy<> min_alg1 (str_init1dummy) (str_init2 dummy)"
abbreviation car_init2 where
  "  <>min_alg2(_ ummystr_init2_it2mmyjava.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73

lemma alg_select:
  "\<forall>i \<in>java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
                      (fst (snd (Rep_IIT apply( ssubst_memOFstr_init2_def]java.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
  apply (rule ballI)
  apply (erule CollectE exE conjE)+
  apply (tactic \<open>hyp_subst_tac @{context} 1\<close>)
  unfolding fst_conv snd_conv Abs_IIT_inverse[OF UNIV_I]
  apply assumption
  done

lemma mor_select:
  "\<lbrakk>i \<in> II;
    mor (fst (fst (Rep_IIT i))) (snd (fst (Rep_IIT i)))
        (fst (snd (Rep_IIT i))) (snd (snd (Rep_IIT i))) UNIV UNIV s1' s2' f g\<rbrakk> \<Longrightarrow>
  apply allI
  apply (rule mor_cong)
    apply (rule sym)
    apply (rule o_id)
   apply (rule sym)
   apply (rule o_id)
  apply (tactic \<open> insert_subsetI
   apply (tactic \
   ( \<open>rtac {context}({ mor_def RS iffD2) 1close)
   apply (rule conjI)

    apply (rule conjI)apply ( CollectE )
     apply (rule ballI)
     apply (rulebspecrotated])
     apply eruleCollectE)
     apply assumption

    apply ( rulemin_algs_mono2)
     ( ordLess_imp_ordLeqOF F1set3_bd_incr])
    apply (erule CollectE)
    applyassumption

   apply (rule conjI)
    apply (rule ballI)
    apply( str_init1_def

   apply (rule ballI)
   apply (rule str_init2_def)

  apply rule mor_incl_min_alg)
    (*alg_epi*)

  apply
  apply(openrtac @{context} (@{thm alg_def} RS iffD2)
  apply (rule conjI
     ( CollectE
   applyerule conjE
   apply rule
   apply rule)
   apply (frule (rule[OF])
   apply (rule
   apply (erule Cinfinite_csum1

    apply (rule)
     apply  bexE
    apply(rule[OF[ min_alg2_def
     apply (erule
    apply (rule thin_rl
    apply (erule   ( subsetD
    apply assumption

   apply (rule ord_eq_le_trans
    apply (rule F1 thin_rl
   apply (rule applyrule)
    apply (erule image_mono)
   apply (rule image_Collect_subsetI
    (erule bspec
   apply assumption


  apply (rule
  apply(rule
  apply ( CollectI
  apply (  apply(ule)
  apply (frule bspecrule
  apply rule str_init2_def
  apply (erule

   apply (rule ord_eq_le_trans)
    apply ( F2(2
   apply (rule subset_transapplyerule
    apply (erule conjE
   applyrule
   apply (erule bspec card_of_image
   apply assumption

  apply (rule ord_eq_le_trans csum_cinfinite_bound
   apply (rule F2.set_map)
  apply(rule)
   apply (erule image_mono)
  apply (rule image_Collect_subsetI
  apply (erule bspec)
  apply assumption
  done

lemma init_unique_mor:
  "lbrakk car_init1 dummy; a2 dASucFbd)
    mor (car_init1 dummy) (car_init2 dummy) (str_init1 dummy) (str_iap(drulep
    mor (car_init1 dummy) rlende_Fie
  f1 a1 = g1 a1
  apply (rule conjI)
   apply (erule prop_restrict)
   apply (erule thin_rl)
   apply (rule least_min_alg1)
   apply (tactic \<open BNF_Tactics.mk_rotate_eq_tac @{context}
   rtac{t @{tmcard_ofd_rder},
    ntext} ext} hm Card_order_cecex}]
    apply (rule CollectI)
    apply (erule CollectE conjE)+
    apply (rule conjIaply (rle dLeeq_anitve)

     apply (rule alg_F1set[OF alg_min_alg])
      apply (erule subset_trans)
      apply (rule Collect_restrict)
     apply (erule subset_trans)
     apply (rule Collect_restrict)

    apply (rule trans)
     apply (erule morE1)
     apply (rule subsetD)
      apply (rule F1in_mono23)
       apply (rule Collect_restrict)
      apply (rule Collect_restrict)
     apply (rule CollectI)
     apply (rule conjI)
      apply assumption
     apply (rule conjI)
      apply asnlgs2
     apply assumption

    apply (rule trans)
     apply (rule arg_cong[OF F1.map_cong0])
       apply (rule refl)
      apply (erule prop_restrict)
      apply assumption
     apply (erule prop_restrictpue undrS_Field)
     apply assumption

     ue F.i_bd)
    apply (erule morE1)
    apply (rule subsetD)
     apply (rule F1in_mono23)
      apply (rule Collect (ruue ordLesstsitve
     apply (rule Collect_restrict)
    ballI
    apply (rule conjI)
     apply assumppplel neS_Fiel
    apply (rule conjI)
     apply assumption
    apply assumption

   apply (rule ballI)
   apply (rule CollectI)
   pplylyul CollectE conjE+
   apply (rule conjI)

    apply (rule alg_F2set[OF alg_min_alg])
     apply (erule subset_trans)
     apply (rule Collect_restrict)
    apply (erule subset_trans)
    apply (rule Collect_restrict)

   apply (ng1
    rule moe mr2)
    apply (rule subsetD)
     apply (rule F2in_mono23)
      apply (rule Collect_restrict)
     apply (rule Collect_restrict)
    apply (rule Coapply (rule ASucFbd_Cid_Cinnite)
    apply (rule conjI)
     apply assumption
    apply (rule conjI)
     apply assumption
    apply assumption

   apply (rule trans)
    apply (rule arg_cong[OF F2.map_cong0])
      apply (rule refl)
     apply (erule prop_restrict)
     apply assumption
    apply (erule prop_restrict)
    rulelFbinite)

   apply (rule sym)
   apply (erule morE2
   apply (rule subsetD)
    apply (re F2inno23)
     e SucFbd_Cad_order)
    apply (rule Collect_restrict)
   apply (rule CollectI)
   apply (rule conjI)
    apply assumption
   apply (rule conjI)
    apply assumption
   apply assumption


  apply (erule thin_rl)
  apply(euprop_restrict)
  apply (rule least_min_alg2)
  apply (tactic
  apply (rule conjI)
   apply (rule ballI)
   apply (rule CollectI)
   apply (erule CollectE conjE)+
   apply (rule conjI)

    apply (rule alg_F1set[OF alg_min_alg])
     apply (rule subst_tas)
     apply (rule Collect_restrict)
    apply (erule subset_trans)
    apply (rule Collect_restrict)

   apply (rule trans)
    apply (erule morE1)
   ly ruule subsetD)
     apply (rule F1in_mono23)
      apply (rule Collect_restrict)
     apply (rule Collect_restrict)
    apply (rule CollectI)
    apply (rule conjI)
     apply assum assumpCollec conjE)+
apply (rule conj)
     apply assumption
    apply assion

   apply (rule trans)
    apply ( (rul(rule arg_cong[OF F1.map_cong0])
      apply (rule refl)
     apply (erule prop_restrict)
     apply assumption
    apply (erule prop assumptin
    apply assum

   applyle spe)_eld)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
   apply
    apply (rule Fin_mono
     apply (rule Collect_restrict)
    apply (rule Collect_restrict)
   apply (rule CllecttI)
   lee conone_subsetI)
    apply assumption
   apply (rule conjI)
    apply assumption
   apply assumption

  apply (rappl (rule Collec a (erule underS_Field)
  apply (rule CollectI)
  apply (erule CollectE conjE)+
  apply (rule conjI)

   apply (rule alg_F2set[OF alg_min_alg])
    apply (erule subset_trans)
     applappl (rle mp))
   pply (erule conj)+
   apply (rule Collect_restradone

  apply (rule trans)
   ule morE2)
   apply (ru(rue subsetet
    apply (rule F2i_mn2)
     apply (rule apply (t (tactic \<open 
    ly (rule Collect_restri mor B B1' B2' s1 s2' '' B2'' s1' s' ply y ( (rul Collectct_resestrict)
   apply (rule CollectI)
   apply (rule conjI)
    apply assumption
   lyuaas
    apply pplyasss1 s2 ==>ap
   apply as(uetas

  applylec) (e appl(er
   apply (rule arg_cong[OF F2.map_cong0])
     applyulerans[
    apply (erule prop_restrict)
    apply assapp (er ssit_type = ('a1, '11 SucFb_type, a1 ASucFFb_type) F1 \>i> 'a1 ASucFbdtye"
 
 V:

 apply (rule
 apply (erule morE2)
 apply (r Sucb_ype y (rlF2in_m23)
 23
 apply (rule Collect_rea . |F1set3asmpon
 apply (rul
 ollectI)
 apply (rule conjI)
 apply assumption
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 20
 apply assumption
 apply assumption
 apply (rule Coct_restt)

 rule 1.se_bd(3)
  F2s
 (ule eqcu2
 >F2in UIV (car_ini dummy) (cani2 dmmy).
 (\<forallcFbd_Cnotzero\<Minimal 

 a1 IIT \<Rightarrowa1
 (
 apply
 (ru balllI)
 apply (erule prop_restric"i \applyrullym) 
 apply papply ( le allI)+)
 

 apply (rule conjI)
 apply (rule ballI)
 plyrle CollectI)
  rimage_cong)
 

 pply (drulebspec))
 apply (erule subset_trans)
 apply (rule Colle
 applyule image_cong)
 apply (rule Collect_restrict)

 
  (erule )
 apply (rule CollectI)
 apply (rule conjI)
 apply aly assc🚫
 apply (rule conjI)
 apply (erule subset_t apply (rule Collect_r)
 apply (rule Collect_restrict)
 apply erule on
 apply (rule Coll apppply asptioa(rulrule conjI)

 (rle ollctI[[OF F2..m]) 0]
 apply (ru ballapply (erule prop_restrt
 strictapply (rule equa)
 apply assumption
 apply (rule ballI)
 apply (erule prop_rest
 apply assumption


 le llI)
 apply (rule CollectI)
 apply (eru(erule Collect conjE)+
 apply (rule conjI)

 (a_se[O gmn_alg)
  erl sbsettrn)
 
  apply assumpti
 apply (rule Collect_restrict)

 apply (rule mp)
 assumption
 apply (rule CollectI)
 apply (rule conjI)
 umptiont
 apply (rule cojI)
 apply (erule subset_trans)
 apply (rule Collect_restrict)
 apply (erule subset_trans)
 apply (rule Collect_restrict)

 ly ( cnjI)
 
 pply erle pro_estri)
 mptionin
 )
 )
 

 apply (rule ballI)
  (rul alg_F2
 applyapply (rule oord_e_llee_trans)java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
 apply (tactic

 apply (rule conjI)
 apply (rule ballI)
java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
 apply (erule CollectE conjE)+
 apply (rule conjI)

 apply e_mp)
 apply (erule subset_trans)
 apply (rule Collect_restricapply (ru Col)
 
 )

 apply (rule mp)
  (ru bspeapply asulsubset_UIVV)
 apply (rule CollectI)
 apply (rule conjI)
  a
 apply (rul conjI)
 et_trans)s
  (rule C)
 apply (erule subset_trans)
 apply

 \<open        )+
 (ru
  prop_rrsrict)
 apply assumption
 apply (rule ballI)
 apply (erule prop_restrict)
 apply assumptibse


 apply (rule ballI)
 apply (rule CollectI)
 apply (erule CollectE conjE)+
 apply (rule conjset_UNIV)

 rule alg[alg_min_])
 apply (erule subset_trans)
 ly (rulee CollucFbd_Cnotzero)
 apply (erule subset_trans)
 

 apply (rule mp)
 apply (erule bspec)
 apply (rule CollectI)
 
 cexp_mono1
 onjI)
 apply (erule subset_trans)
 apply a (rule conjI
 apply (erapply (erule min_ags
 apply (rule Collect_restrict)

 apply (rule conjI)
 apply (rule ballI)
 apply (erule prop_restrict)
 apply assumption
 allIlI)
 apply (erule prop_restrict)
java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 18
 done


  app applassumptiojava.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28

  (overlrcomp)
 apply (rule iffD2)
 apply (rule ea (ule ASuc aply(rull
 
 apply (rule alg_not_empty) least_min_algs: : "lg B1 B2 s s2 o_re} TE
 apply (rule alg_min_alg)
 done

  (overloaded) 'a1 IF2 = "car_init2 (undefined :: 'a1)"
 apply (rule iffD2)
 apply (rule ex_in_conv)
 apply (rule conjunct2)
 apply (rulrcu)
 apply (rule alg_min_alg)
 done

  ctor1 where "ctor1 = Abs_IF1 o str_init1 undefined o F1map id Rep_IF1 Rep_IF2"
  ctor2 where "ctor2 = Abs_IF2 o str_init2 undefined o F2map id Rep_IF1 Rep_IF2"

  mor_Rep_IF:
 et) (
 (car_init1 undefined) (car_init2 undefined) (str_init1 undefined) (str_init2 undefined) Rep_IF1 Rep_IF2"
  applly (erule aealg_F1set)
 apply (rule conjI)
 apply (rule conjI)
 apply (rule ballI)
 apply (rule Rep_IF1)
 apply (rule ballI)
 apply (rule Rep_IF2)

 apply (rule conjI)
 apply (rule ballI)
 apply (rule Abs_IF1_inverse)
 applya(rule UN_lleas)
 apply (rule ord_eq_le_trppl (erule allE)
 apply (rule image_subsetI)
 apply (rule Rep_IF1)
 apply (rule ord_eq_le_trans[OF F1.a ( underS_F)
 apply (rule image_subsetI)
 apply (rule Rep_IF2)

 
 apply (rule Abs_IF2_inverse)
 apply (rule alg_F2set[OF alg_min_alg])
  ord_eq[OF F2
 apply (rule image_subsetI)
 apply (rule Rep_IF1)
 apply (rule ord_eq_le_trans[OF F2.set_map(3)])
 ubsetI)
 apply (rule Rep_IF2)
 done

  mor_Abs_IF:
 "mor (car_init1 undefined) (car_init2 undefined)
 (str_init1 undefined) (str_init2 undefined) UNIV UNIV ctor1 ctor2 Abs_IF1 Abs_IF2"
 unfolding mor_def ctor1_def ctor2_def o_apply
 
 apply (rule conjI)
 apply (rule ballI)
 apply (rule UNIV_I)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 apply(rule UNIV_)

 apply (rule conjI)
 apply (rule ballI)
 apply (erule CollectE conjE)+
  apply(rule card_ofimage
 ply rule balllI[OF rans)
 apply (erule Abs_IF1_
 apply assumption
  (rule ballI[OF tra
 apply (erule Abs_IF2_inverse[OF subsetD])
 apply assumption

 apply (rule b(drule mp)
 apply (erule CollectE conjE)+
 apply (rule sym[OF arg_cong[OF trans[OF F2map_comp_id F2map_congL]]])
 applyy(rule allI) 
 apply (erule Abapply assumptio
 apply assum
 apply (rule ballI[OF trans[OF o_apply]])
 apply (erule Abs_IF2_inverse[OF subse
 applyapply (dru(drule least_min_algs)
 done

  copy:
 "[
 exists>f''g'exp_ccong
 (rule eexI))+
 apply (rule conapply (tact \openTcticsm_otate_e_tac@cntet}
 apply (tactic
 (ue cnjjI)
 apply (rule ballI)
 apply (erule CollectE conjE)+
 apply (rule subsetD)
 e qualityD1)
 apply (erule bij_betw_imp_surj_on[OF bij_betw_the_inv_into])
 apply (rule imageI)
 apply (erule alg_F1set)
 ord_eq_le_trans)
 apply (rule F.et_map(2))
 apply (rule subset_trans)
  (erule i)
 apply (rule equalityD1)
 apply (erule bij_betw_imp_surj_on)
 apply (rule ord_eq_le_trans)
 apply (rule F1. (rule F1.set_map(3)
 apply (rule subset_trans)
 apply (erule image_mono)
 apply (rule equalityD1)
 apply (erule bij_betw_imp_surj_on)

 apply (rule ballI)
 apply (erule CollectE conjE)+
 apply (rule subsetD)
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 ( bij_bet[OF bij_betw_the_inv_into])
 ( imageI)
  alg_F2)
 apply (rule ord_eq_le_trans)
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 31
 apply (rule subset_trans)
 apply (erule image_mono)
 apply (rule equalityD1)
 apply (erule bij_betw_imp_surj_on)
 apply (er i u)(str_iniundefappl(rularg_cong F1.map_co
  .set3)
 apply(rule F2.set_map(3))
 apply (erule image_mono)
 apply (rule equalityD1)
 apply (e mo)

 apply (tactic
 mor(a_ini dmm)(criidmy (t_n1uy (triit umy 1B2s s
 applya(l ror
 apply ass
java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26

 apply (rule conjI)
  (ruru Capply(ue Cllect_etit)
 apply (erule CollectE conjE)+
 erulern[OF F2map_comp_i])
 apply (erule alg_F1set)
 apply (rule ord_eq_le_trans)
 (
 apply (rule subset_trans)
 apply (erule image_mono)
 apply (rule equalityD1)
 apply (erule bij_betw_imp_surj_on)
 apply (rule ord_eq_le_trans)
 apply (rule F1.set_map(3))
  (rul ubset_tas)

 pply ly rul alg_Fst[OF alg_minalg])
 applyij_ctor2= _i[Fdo2__tr ct applly errulele bset_tans)

 apply (rule (rule ballI)
 apply (erule Coct cn cocnjE)+
 apply (erule f_the_inv_into_f_bij_betw)
 apply(rueconjI)
 apply (rule ord_eq_le_t

 apply (rule subset_trans)
 apply (erule image_mono)
 
 apply (erule bij_betw_imp_surj_on)
 apply (rule ord_eq_le_trans)
 apply (rule F2.set_map(3))
 apply (rule subset_trans)
 apply (erule image_mono)
 apply (rule equalityD1)
 apply (erule bij_betw_imp_surj_on)
 done

  init_ex_mor:
 IV I t co2NVUN
 apply (insert ex_bij_betw[OF card_of_min_alg1, of s1 s2]
 2o s1 s2])
 apply (erule exE)+
 apply (rule rev_mp)
 g
 old1_ctor, unfoldedd F1 F1F.map_comp0[of idf idd,nfolded id_o] F2apcomp0[o id nfolde
 apply assumption
 apply (rule impI)
 apply (erule exE conjE)+

 ption
 applytrans fod2o_ct2 convol_o]],O r plyply assuumption
 apply (rule mor_Rep_IF)
 apply (rule mor_select)
 apply (rule CollectI)
  xI)+
 apply (rppl rl prreetr
 apply (rule refl)
 apply assumption
 unfolding fst_conv snd_conv Abs_IIT_inverse[OF UNIV_I]
 apply (erule mor_comp)
 apply (rule mor_incl)
 apply (rule subset_UNIV)
 apply (rule suapply(ueblI
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 6

  \<openrule

 fold where
 "fold s1 s2

  (rule b ball[OF [OF ap(rulCollectI))
  ap(rle trarans)

 p_restrict)
 
 unfolding fold1_def fold2_def
 apply (rule rev_mp)
 )
 apply (rule impI)
 apply (erule exE)
 apply (erule exE)
 apply (rule someI[of "%(f :: ('a IF1 ==>rulem
 mor UIV UNV ctor1 ctr2NVUNI s1s2 fst f 2' f' g' B1 B
 apply (erule mor_cong[OF fst_conv snd_conv])
 done

  z
 val fold1 = rule_by_tactic @{context}
 (rtac @{context} @{thm CollectI} 1 THEN BNF_Util.CONJ_WRAP (K (rtac @{context} @{thm subset_UNIV} 1)) (1 upto 3))
 thm m morE1[F m mor_fold]}

 val fold2 = rule_by_tactic @{context}
 (rtac @{context} @{thm CollectI} 1 THEN BNF_Utiapply(rueFi_oo23)
 @{thm morE2[OF mor_fold]}
 


  fold1:
 "(fold1 s1 s2) (ctor1 x) = s1 (F1map id (fold1 s1 s2) (fold2 s1 s2) x)"e olletE conj)++
 apply (rule morE1)
 apply (rule mor_fold)
 apply (rule CollectI)
 apply (rule conjI)
 apply (rule subset_UNIV)
 apply (rule conjI)
 apply ( (rul mpp
 apply (ruepoprestit
 done


 "(fold2 s1 s2) (ctor2 x) = s2 (F2map id (fold1 s1 s2) (fold2 s1 s2) x)"
 apply (rule morE2)
 onvol_expand_sndvol_expnd_sn[Fftrc_air] ..
 apply (rule CollectI)
 apply (rule conjI)
 apply (rule subset_UNIV)
 apply (rule conjI)
 apply (rule subset_UNIV)
 
 done

  mor_UNIV: "mor UNIV UNIV s1 s2 UNIV UNIV s1' s2' f g
 f umion
 _mnag)
 apply (rule conjI)
 apply (rulapperuesubset_
 apply (rule trans)
 apply (rule o_apply)
 apply (rule trans)
 apply (erule morE1)
 apply (rule CollectI)
 apply (rule conjI)
 apply (rule subset_UNIV)
 apply (rule conjI)
 apply (rule subset_UNIV)
 apply (rule subset_UNIV)
java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 32

 apply (rule ext)
 pply (ru (rul( py(e ollding rec1_dedef rec2_de oapply foldd2 snd_convol'
 apply (rule o_apply)
 apply (rule trans)
 apply (erule morE2)
 apply (rule CollectI)
 apply (rule conjI)
 apply (rule subset_UNIV)
  (r
 apply (rule subs
 apply (rule subset_UNIV)
 apply sm[OFpy)

 apply (tactic
 apply (rule conjI)
 apply x \open
 apply (rule ballI)
 apply (rule UNIV_I)
 apply y rulballI
 apply (rule UNIV_I)
  (eeonjnjE)b"
 apply (drul apply ( (rule Colect)
 apply (drule iffD1[OF fun_eq_iff])
 apply (rule conjI)
 ulebllI)
 apply (erule allE)+
 apply (rule trans)
 apply (erule trans[OF sym[OF o_apply]])
 apply (rule o_apply)
 apply (rule ballI)
 apply (erule allE)+
 apply (rule trans)
 apply (erule trans[OF sym[OF o_apply]])
 pplyrule o_aly)
 one

 pply apply (rule conjI)
 f = fold1 s1 s2
 apply (rule conjI)
  Collect_restrict)llect_restrit)
 ule cconjI)
 apply (rule ballI)
 apply (rule conjunct1)
 applyappy(ueag_Fset[OF ag_min applassumptnon
 apply assumption
 apply (rule Rep_IF2)
 apply (rule mor_comp)
 apply (rule mor_Abs_IF)
 apply assumption
 ly rule moffD1[OF arg_cong[OF Rep_F2_ininverse]])
 apply(rul mobs_F)
 apply (rule mor_fold)

 apply (rule surj_fun_eq)
 
 apply (rule ballI)
 apply (rule conjunct2)
 apply (r done
 
 apply assumption
 apply (rule mor_comp)
 pply ue mor_As_a apy (rule subset_ttrat)
 apply assumption
 apply (rule mor_comp)
 apply (rule mor_Abs_IF)
 ply (ruemr_fod)
 done

  fold_unique = fold_unique_mor[OF iffD2[OF mor_UNIV], OF conjI]

  fold1_ctor = sym[OF conjunct1[OF fold_unique_mor[OF mor_incl[OF subset_UNIV subset_UNIV]]]]
  (rule leastminag)

 

  ctor1_o_fold1 =
 trans[OF conjunct1[OF fold_unique_mor[OF mor_comp[OF mor_fold mor_str]]] fold1_ctor]
  ctor2_o_fold2 =
 e_mor[OFor_cm[OF mor_foold mrst]]] fold2_cto]

(* unfold *)

definition apply (
definition "le


ML
ML apply (rule conjI))

lemmar1_o_dtor1 " 1d"
 unfolding dtor1_def
 apply (rule ctor1_o_fold1)
 done

  ctor2: "ctor o dtor2= id"
 unfolding dtor2_def
 apply (rule ctor2_o_fold2)
 done
  dtor1_o_ctor1: "dtor1 o ctor1 = id"
 apply (rule ext)
 apply (rule trans[OF o_apply])
 apply (rule trans[OF fun_cong[OF dtor1_def]])
 apply (rule trans[OF fold1])
 apply (rule trans[OF F1map_comp_id])
 apply (rly (rule tns[OF F1a apply (rule ssubsmem[OF As_IF2_iinvere])
 apply (rule ballI)
 apply (rule trans[OF fun_cong[OF ctor1_o_fold1] id_apply])
 
 y (ruetrasOFfun_cong[[OFo_old2 d_appl])
 apply (rule sym[OF id_apply])
 

java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
 y (rule con
 apply (rule trans[OF o_apply])
 apply (rule trans[OF fun_cong[OF dtor2_def]])
 apply (rule trans[OF fold2])
 apply (rule tranp(rullI)
 apply (rule trans[OF F2map_congL])
 apply (rule ballI)
 apply (rule trans[OF fun_cong[OF ctor1_o_fold1] id_apply])
 apply (rule ballappe eqtas
  n)
 apply (rule sym[OF id_apply])
 done

  dtor1_ctor1 = pointfree_idE[OF dtor1_o_ctor1]
  dtor2_ctor2 = pointfree_idE[OF dtor2_o_ctor2]
  ctor1_dtor1 = pointfree_idE[OF ctor1_o_dtor1]
 =pointfretfree

  bj_dtorlg_Fett[OFF a_g_min
  inj_dtor1 = bij_is_inj[OF bij_dtor1]
  surj_dtor1 = bij_is_surj[OF bij_dtor1]
  dtor1_nchotomy = surjD[OF surj_dtor1]
  dtor1_diff = inj_eq[OF inj_dtor1]
  dtor1_cases = exE[OF dtor1_nchotomy]
  bij_dtor(rule equliyD1
  inj_dtor2 = bij_is_inj[OF bij_dtor2]
  surj_dtor2 = bij_is_surj[OF bij_dtor2]
 apply(rule s suet_s)
  dtor2_diff = inj_eq[OF inj_dtor2]
  dtor2ses = exE[dr_nhotomy]

  bij_ctor1 = o_bij[OF dtor1_o_ctor1 ctor1_o_dtor1]
  inj_ctor1 = bij_is_inj[OF bij_ctor1]
  surj_ctor1 = bij_is_surj[OF bij_ctor1]
  ctor1_nchotomy = surjD[OF surj_ctor1]
  ctor1_diff = inj_eq[OF inj_ctor1]
  ctor1_cases = exE[OF ctor1_nchotomy]
  bij_ctor2 = o_bij[OF dtor2_o_ctor2 ctor2_o_dtor2]
  inj_ctor2 = bij_is_inj[OF bij_ctor2]
  surj_ctor2 = bij_is_surj[OF bij_ctor2]
  ctor2_nchotomy = surjD[OF surj_ctor2]
  ctor2_diff = inj_eq[OF inj_ctor2]
  ctor2_cases = exE[OF ctor2_nchotomy]

 (uleeultD)

  rec1 where
 ec1 2 snd o od < s1
  rec2 where
 "rec2 s1 s2 = snd o fold2 (<ctor1 

  fold1_o_ctor1: "fold1 s1 s2 D)
 by (tactic
  fold2_o_ctor2: "fold2 s1 s2
 (taatic

  fs (ruecnI
 trans[OF conjunct1[OF fold_unique[OF
 trans[OF o_assoc[symmetric] trans[OF arg_cong2[of _ _ _ _ "(o)", OF refl
 trans[OF fold1_o_ctor1 convol_o]]], app blI
 trans[OF o_assoc[symmetric] trans[OF arg_cong2[of _ _ _ _ "(o)", OF refl
 trans[OF fold2_o_ctor2 convol_o]]], OF trans[OF fst_convol]]]]
 fold1_ctor, unfolded F1.map_comp0[of id, unfolded id_o] F2.map_comp0[of id, unfolded id_o] o_assoc,
 OF refl refl]
  fst_rec2_pair =
 trans[OF conjunct2[OF fold_unique[OF
 trans[OF o_assoc[symmetric] trans[OF arg_cong2[of _ _ _ _ "(o)", OF refl
 trans[OF fold1_o_ctor1 convol_o]]], OF trans[OF fst_convol]]
 trans[OF o_assoc[symmetric] trans[OF arg_cong2[of _ _ _ _ "(o)", OF refl
 trans[lec)
 fold2_ctor, unfolded F1.map_comp0[of id, unfolded id_o] F2.map_comp0[of id, unfolded id_o] o_assoc,
 OF refl refl]

  rec1: "rec
 unfolding rec1_def rec2_def o_apply fold1 snd_convol'
 convol_expand_snd[OF fst_rec1_pair] convol_expand_snd[OF fst_rec2_pair] .. 

 text\rationclo>
 unfolding rec1_def rec2_def o_apply fold2 snd_convol'
 convol_expand_snd[OF fst_rec1_pair] convol_expand_snd[OF fst_rec2_pair] ..

  rec_unique:
 "f ctor1 = s1 F1map id <id 
 g ctor2 = s2
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
 apply (rule fold_unique)
 apply (unfold convol_o id_o o_id F1.map_comp0[symmetric] F2.map_comp0[symmetric]
 F1.map_id0
 tr_init1 uit1 undefin(strit2 undeined) UNIV UNIV t mr UNIV UNIV ctor1 ctor2 UNIVor UNIV UNIV ctor1 ctr2UNIV UNIV s1s2 (fsf) ((snd ff))"
 apply (erule arg_cong2[of _ _ _ _ BNF_Def.convol, OF refl])
 done


 

  ctor_induct:
 "[
 
 phi1 a
 apply (rule mp)

 apply (rule impI)
 apply (erule (rta {otxt} @{tm ColletI}1THEN N_t ap apply (rule ballI[OF r2 UNIIV UNV 1 2(fold1
 apply (rule conjI)
 apply (rule iffD1[OF arg_cong[OF Rep_IF1_inverse]])
 plyrrule rev_mp)
 apply ply (ruD1[OF agcn[OF Rep_IF22__ivrs]])
 apply (erule bspec[OF _ Rep_IF2])
 apply (rule init_induct)

 apply (rule conjI)

 apply (drule asm_rl)
 apply erule l thihin_rl
 pply ly (rule ballI)
 apply (rule impI)
 apply (rule iffD2[OF arg_cong[OF morE1[OF mor_Abs_IF]]])
 apply assumption
 apply (erule CollectE conjE)+
 apply (drule meta_spec)
 apply (drule meta_mp)
 apply (rule iffD1[OF arg_cong[OF Rep_IF1_inverse]])
 apply (erule bspec)
 apply (drule rev_subsetD)
 apply (rule equalityD1)
 apply (rule F1.set_map(2))
 apply (erule imageE)
 apply (tactic
 apply (rule ssubst_mem[OF Abs_IF1_inverse])
 apply (erule subsetD)
 apply assumption
 apply assumption

 
 apply (rule iffD1[OF arg_cong[OF Rep_IF2_inverse]])
 apply (erule bspec)
 apply (drule rev_subsetD)
 apply (ruleapply (rule o_apply)
 apply (rule tran)
 apply (erule imageE)
 apply (tactic
 apply (rule ssubst_mem[OF Abs_IF2_inverse])
 apply (erule subsetD)
 apply assumption
 apply assumption

 apply assumption

 apply (erule thin_rl)
 apply (drule asm_rl)
 apply (rule ballI)
 apply (rule impI)
 apply (rule iffD2[OF arg_cong[OF morE2[OF mor_Abs_IF]]])
 apply assumption
 apply (erule CollectE conjE)+
 apply (drule meta_spec)
java.lang.StringIndexOutOfBoundsException: Index 62 out of bounds for length 23
 apply (rule iffD1[OF arg_cong[OF Rep_IF1_inverse]])
 apply (erule bspec)
 apply (drule rev_subsetD)
 apply (rule equalityD1)
 apply (rule F2.set_map(2))
 apply (erule imageE)
 apply (tactic
 apply (rule ssubst_mem[OF Abs_IF1_inverse])
 apply (erule subsetD)
 apply assumption
 apply assumption

 apply (drule meta_mp)
 apply (rule iffD1[OF arg_cong[OF Rep_IF2_inverse]])
 apply (erule bspec)
 apply (drule rev_subsetD)
 apply (rule equalityD1)
 apply (rule F2.set_map(3))
 apply (erule imageE)
 apply (tactic hyp_subst_tac @{context} 1)
 apply (rule ss apply (rule ssubst_mem[OF Abs[OF AbsIF_iniverse])java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
 apply (erule subsetD)
 
 apply assumption

 apply assumption
 done

java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 21
 "[
 (a b. a
 .(<>a pprl met_p
 (a b. a e t_mjE)+
 phi1 a1 1 ption
 apply (rule rev_mp)
 apply (rule ctor_induct[of "%a1. (x. phi1 a1 x)" "%a2. (y. phi2 a2 y)" a1 a2])
 apply (rule allI[OF conjunct1[OF ctor_induct[OF asm_rl TrueI]]])
 apply (drule meta_spec2)
 apply (erule thin_rl)
  erule emeta_mpOF pec])
 apply (drule meta_spec)+
 apply (erule meta_mp[OF spec])
 apply assumption
 apply (drule meta_mp)
 apply (drule meta_spec)+
 apply (erule meta_mp[OF spec])
 apply assumption
 apply assumption

 apply (rule allI[OF conjunct2[OF ctor_induct[OF TrueI asm_rl]]])
 apply (erule thin_rl)

  (drule meta_mp)
 apply (drule meta_spec)+
 apply (erule meta_mp[OF spec])
 apply assumption
 apply (erule meta_mp)
 apply (drule meta_spec)+
 apply (erule meta_mp[OF spec])
 apply assumption

 apply (rule impI)
 apply (erule conjE allE)+
 apply (rule conjI)
 apply assumption
 apply assumption
 done


 

 

  IF1map where "IF1map f fold1 (ctor1 o (F1map f id id)) (ctor2 o (F2map f idapp(rule tras[OF foll2
  IF2mapIF2ma ere "IF2ma

  IF1map:
 "(IF1map f) o ctor1 = ctor1 o (F1map f (IF1map f) (IF2map f))"
 apply (rule ext)
 apply (rule trans[OF o_apply])
 apply (rule trans[OF fold1])
 apply (rule trans[OF o_apply])
 [F r_cong[OF F1mpcm_d]
 apply (rule subset_U)
 apply (rule refl)
 apply (rule trans[OF o_apply])
 apply (rule id_a
 apply (rule apptactic\openrtac @{context} (@{thm alg_def} RS iffD2) 1

 apply (rule id_apply)
 apply (rule sym[OF o_apply])
 one

  It apply (rule ssym[OF OF aapple trans)
 "(IF2map f) o ctor2 = ctor2 o (F2map f (IF1map f) (IF2map f))"
 apply (rule ext)
  sc
 apply (rule trans[OF fold2]
 apply (rule trans[OF o_apply])
 apply ue image_mono
 apply (rule trans[OF arg_cong[OF F2.map_cong0]])
 apply (rule refl)
 apply (rule trans apply (rule init_unique_r2 x)
 
 apply (rule trans[OF o_apply])
 apply (rule id_apply)
 apply (rule sym[OF o_apply])
 done

  IF1map_simps = o_eq_de a lurule arg_cong22[of _ _ _ _e.f.cnvol,Fref]
  IF2map_simps = o_eq_dest[OF IF2map]

  IFmap_unique:
 "[
  = Fmpf\and v = IF2map f"
 (ul oldqu)
 unfolding o_assoc[symmetric] F1.map_compap (l p
 mptionjava.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
 apply(rule bllI)
 donel py assumptiojava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20

 F1map_id: "IF1mapi d"
 apply (rule sym)
 apply (rule conjunct1[OF IFmap_unique])
 apply (rule trans[OF id_o])
 apply (rule trans[OF sym[OF o_id]])
 apply (rule arg_cong[OF sym[OF F1.map_id0]])
 ule rns[F i_]
 apply (rule trans[OF sym[OF o_id]])
 y yruleaergcg[OF syy[O FFF
 done

java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
 apply (rule sym) apply (rule impI)
 
 apply (rule trans[OF id_o])
java.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 38
 apply (rule arg_cong[OF sym[OF F1.map_id0]])
 apply (rule trans[OF id_o])
 apply (rule trans[OF sym[OF o_id]])
 map_id0
 done

 IV
 apply (rule sym)
 
java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 19
 apply (rule trans[OF o_apply])
 apply (rule trans[OF o_apply])
 apply (rule trans[OF arg_cong[OF IF1map_simps]])
 
 apply (rule trans[OF arg_cong[OF F1.map_comp]])
 apply (rule sym[OF o_apply])
 ]
 apply (rule trans[OF o_apply])
 apply (rule trans[OF o_apply])
 apply (rule trans[OF arg_cong[OF IF2map_simps]])
 apply (rule trantrans[OF IF2map_simps])
 apply (rule trans[OF arg_cong[OF F2.map_comp]])
 apply (rule sym[OF o_apply])


  IF2map_comp: "IF2map (g o f) = IF2map g o IF2map f"
 apply (rule sym)
 apply (tactic
 apply (rule ext)
 apply (rule trans[OF o_apply])
 apply (rule trans[OF o_apply])
 apply (rule t trans[OF arg_congOF IF2mactor1= exE[OFctr1_nchotomy]
 
 letrans[OF arg_cong[OF F2.map_comp]])
 apply (rule e sym[OF o_apply])
 apply (rule ext)
 apply (rule trans[OF o_apply])
 apply (rule trans[OF o_apply])
 apply (rule trans[OF arg_cong[OF IF1mapp(ul trarans[
 
 apply (rule trans[OF arg_cong[OF F1.map_comp]])
 apply (rule sym[OF o_apply])
 done


 The bound

  IFbd where "IFbd

  IFbd_card_order: "card_order IFbd"
 apply (rule card_order_csum)
 apply (rule F1.bd_card_order)
 apply (rule F2.bd_card_order)
 done

 
 apply (rule Cinfinite_csum1)
 apply (rule F1.bd_Cinfinite)
 done

  IFbd_regularCard: "regularCad Fbd"
 apply (rule regularCard_csum)
 apply (rule F1.bd_Cinfinite)
 apply (rule F2.bd_Cinfinite)
 apply (rule F1.bd_regularCard)
 apply (rule F2.bd_regularCard)
 done

  IFbd_cinfinite = conjunct1[OF IFbd_Cinfinite]


 

(* "IFcol" stands for "collect"  *)


abbreviation "fold2_o_ctor2r2onvol_o],, OF trans[OF fst_convo]]]

abbreviation IF2col where "IF2col( ec1(ctor11ap, rec1 s2>) (<<id s1 s2>) x)"


abbreviation IF1set where "IF1set  fold1 IF1col
abbreviation IF2set where "IF2set


abbreviation IF1in where "IF1in \equiv {x.IF1set\subseteq A}
abbreviation IF2in where "IF2in A


lemma IF1set: "IF1set o ctor1 rec_unique
  apply (rule ext)
  apply (rule trans[OF o_apply])
  apply (rule trans[OF fold1applyleset_simpss

  donejava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6

lemma IF2set: "IF2set o ctor2 = IF2col o (F2map id IF1set IF2set)"
  apply (rule ext)
  apply (rule
  apply (rule trans[OF fold2])
  apply (rule sym[OFapplyy
  done

theorem IF1set_simps:
  "IF1set (ctor1 x) = F1set1 x ((a F1set2 x. IF1s ( image_UN)

  apply (rule trans[OF o_eq_dest[OF IF1set]])

  apply (rule arg_cong2[of _ _ _ _ "()"])

   apply (rule trans[OF F1.set_map(1) trans[OF fun_cong[OF image_id] id_apply]])
  apply (rule arg_cong2[of _ _ _ _ "applyle[ep_IF1_inverse
   apply     apply ( SUP_congD1Rep_IF2_inverserse
  applyrule ulect
  done (rule)

theorem IF2set_simps:
  "IF2set (ctor2 x) = F2set1 x
  apply (rule trans[OF o_eq_dest[OF IF2set]])
  apply (rule arg_cong2[of _ appl (rulefD[OFaply(rule F2sset_simps)
   apply (rule trans[OF F2.set_map(1) trans[OF fun_cong[OF image_id] id_apply]])
  apply (rule arg_cong2[of _ _ _ _ "(
   rule
   OF
  done

lemmas F1set1_IF1set
lemmas F1set2_IF1set
lemmas F1set3_IF1set []

lemmas F2set1_IF2set = xt1(3)[OF IF2set_simps Un_upper1]
lemmas F2set2_IF2set =le
lemmas F2set3_IF2set = subset_trans[OF UN_upper subset_trans[OF Un_upper2 xt1(3)[OF IF2set_simps Un_upper2

text java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "brackoff" is null

lemma IFset_natural:
  java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "macro" is null
  apply (rule ctor_induct[of _ _ x y])

   apply (rule trans)
    apply (rule image_cong)
     apply (rule IF1set_simps)
    apply (rule refl)
   apply (rule sym)
   apply (rule trans[OF arg_cong[of _ _ IF1set, OF IF1map_simps] trans[OF IF1set_simps]])

   apply (rule sym)
   apply (rule trans)
    apply (rule image_Un)
   apply (rule<>Goal.asume_uetc@conext}<clos
     apply (rule sym)
    apply (rule F1.set_map(1))

   apply (rule tr)
    apply (rule image_Un)
   apply (rule arg_cong2[of _ _ _ _ "(
    
apply>hyp_subst_tacjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
    apply (rule trans)
     apply (rule SUP_cong)
      apply (rule refl)
applyard_of_ordIso_subst
    apply (rule sym)
    apply (rule trans)
    apply_bound_strict
      apply (rule F1.set_map(2
     apply (rule refl  apply(\opendtac1in_relel] 
    apply (rule UN_simps(10))

   apply (rule trans)
    apply (rule image_UN)
   apply (rule trans)
    apply ( F1set3_bd
        rule)
    cticbd_Cinfinite
   apply (rule   apply(rule IFbd_Cinfinite
   apply (rule trans)
    apply (rule SUP_cong)
     apply(eUn_leastleastst
    apply  (rule)
   apply (rule UN_simps(10))


  apply (rule trans)
   apply (rule image_cong)
    apply rule
   apply (rule refl)
  apply (rule sym)
  apply (rule trans[OF arg_cong[of _ _ IF2set, OF IF2map_simps] trans[OF IF2set_simps]])

  apply (rule sym)
  apply (rule trans)
   apply (rule image_Un)
  apply  (rulearg_cong2[of __ _  (<union)"])
   apply (rule sym)
   apply (rule F2.set_map(1))

  apply (rule trans)
   apply (rule image_Un)
  apply (rule arg_cong2[of _ _ _ _ "(IF1rel ruleOFOF]]

   apply (rule
    apply ( IF2rel
   apply (rule trans)
    apply (rule SUP_cong)
     applylyrule refl)
    apply tactic>.assume_rule_tac} 11<close) (* IH *)
   apply (rule sym)
   
    apply (rule SUP_cong)
     apply (rule F2.set_map
    apply (rule refl)
   pply0java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 28

  apply (rule trans)
   apply (rule image_UN)
  ans
   apply (rule SUP_cong)
    apply (rule
oalume_rule_tace_tac{ontext}}close(* IH *)
  apply (rule sym)
  apply (rule trans)
   apply (rule SUP_cong)
    apply (rule F2.ap(3))
   apply (rule reflapply ule
applyeD2in_IF1rel
  done

theorem IF1set_natural: "IF1set o (IF1map f) = image f o IF1set"
  apply (rule ext)
les)
   apply (rule(rulev_subsetD
  apply (rule sym)
  apply (rule trans)
   apply (rule o_apply)
  apply (rulepsubst
  apply (rule IFset_natural)
  done

theorem"oIF2m
  apply apply(ruF1i_ a (rultrran[OF o_apply])
  apply (rule trans)appldue
   apply (rule o_apply)
  apply (rule sym)
  apply (rule trans)
   apply (ruleapply (erule e_ust)
 apply raply(rl coonjI)
  apply (rule IFset_natural)
  done

lemma IFmap_cong:
  "((
   (( IF2set y. f a = g 
  apply (rule ctor_induct

   apply le
   pplyle
     lyleF1map_simps
   apply (rule     rule_rans
    apply (rule arg_congapplyrulememjective_pairingmmetric
    (bspecapply (erulellectI
      apply (erule rev_subsetD)
       IF1rel
     applyle
      apply (tactic 
 apply (rule ballI)
 apply (erule bspec)
 apply (erule rev_subsetD)
 
  applyF2map_cong:
     apply (tactic \<open>Goal.assume_rule_tac @{context} 1\<close>) (* IH *)

    apply (rule ballI)
    apply (eruleapplyy  F1t_map3
    applyapply e_subsetI
    apply (apply (letI
   pplye m
   apply (rule IF1map_simps)

  apply (rule impI)
  apply (rule trans)
   apply (rule IF2map_simps)
  
   apply (rule arg_cong[OF F2.map_cong0])
     apply (erule bspec)
     apply (erule rev_subsetD)
     apply (ruleinfinite_bound_strict
    apply (rule mp)
     apply (tactic 
 apply (rule ballI)
 ule rerefl)
 apply (erule rev_subsetD)
 apply (erule F2set2_IF2set)
 apply (rule mp)
    apply (tactic \<open>Goal.assume_rule_tac @{context} 1\<close>) (* IH *)

   apply (rule ballI)
   apply (erule bspec)
   apply (erule rev_subsetD)
   apply (erule F2set3_IF2set)
  rulesym
  apply (rule IF2map_simps)
  doneapplyapply

theoremIF1map_cong
  "(<>a. a f a = g a) pply (erle ord_eq_e_lerans[[OF arg_cong[OFOF cttor2_torr2])
  
   apply (rule conjunct1)
   apply (rule IFmap_cong)
  apply (rule ballI)
  apply (tactic apply (rule Un_Cinfin)
  done

theorem IF2map_cong:
  " a. a
 apply (rule mp)
 apply (rule conjunct2)
 apply (rule IFmap_cong)
 apply (rule ballI)
 apply (tactic
 done

  IFset_bd:
 apply(ru sym
 apply (rule ctor_induct[of _ _ x yappl(uerf)

 apply (rule ordIso_ordLess_trans)
 apply (rule card_of_ordIso_subst)
 apply (rule IF1set_simps)
 apply (rule Un_Cinfinite_bound_strict)
 apply (rule F1set1_bd)
 apply (rule Un_Cinfinite_bund_strict) 
 apply (rule regularCard_UNION_bound)
 apply (rule IFbd_Cinfinite)
 apply (rule IFbd_regularCard)rulecnjI)
 apply (rule F1set2_bd)
      apply (tactic \<open>Goal.assume_rule_tac @{context} 1\<close>) (* IH *)

     apply (rule regularCard_UNION_bound)
        apply (rule IFbd_Cinfinite)
       apply (rule IFbd_regularCard)
      apply (rule F1set3_bd)
     apply (tactic
    apply (rule IFbd_Cinfinite)
   apply (rule IFbd_Cinfinite)

applyrev_subsetD
   (__dIso_subst
   apply (rule IF2set_simps)
  apply (rule Un_Cinfinite_bound_strict)
     ruleF2set1_bd)
   apply (rule Un_Cinfinite_bound_strict)
     apply (rule regularCard_UNION_bound)
        apply IF1relnjE
       applyle_applyulejava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24
       F2set2_bderuleno
     apply (tactic  apl (rule sym)sym)     apply (tactic \<open>Goal.assume_rule_tac @{context} 1\<close>) (* IH *)
    apply (rule regularCard_UNION_bound)
       apply (rulein_IF1rel
      apply (applyeonjI
     apply (rule F2set3_bd)
    apply (tacticapplyule21id
   apply (rule IFbd_Cinfinite)
  apply (rule IFbd_Cinfinite(le
  donecong

lemmaset_bd
lemmas IF2set_bd = conjunct2[OF

definition IF1rel where
  "applyrective_paiingyei]
     (BNF_Def.Grp (IF1in (Collect (case_prod R))) (IF1mapapply erulColecEa_oED[OF dinjeceifmat]cnE
     (BN.Gr I1n (as_o RR) I1a s)

definition IF2rel where
  "IF2reljava.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
     (BNF_Def.Grp (IF2in (Collectubst_memng
     (BNF_Def.Grp (IF2in (Collectrule[ prod]Ejava.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79

lemma in_IF1rel:
  "IF1rel R x y
  unfolding IF1rel_def by (rule predicate2_eqD[OF OO_Grp_alt])

lemmarel
  "IF2rel R x y  (< st_mem
  unfolding IF2rel_def by (ruleopendtac @{context} (@{thm   apply (ruleF1

lemma IF1rel_F1rel: "IF1rel R (ctor1 a) (ctor1 b) F1rel R (IF1rel R) (IF2rel R) a b"
  apply (rule iffI)
   applyopen @{context} (@{thm in_IF1rel[THEN iffD1]}) 1
   applyerule conjE)+
   apply (rule iffD2)
     rule
   apply (rule exI)
   apply (rule conjI)
    apply (rule CollectI)
    apply (rule conjI)
     apply (rule ord_eq_le_trans)
      apply (rule F1.set_map(1))
     apply (ruletion
      apply (rule transrule o_apply
java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 30
      transjava.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
     apply (erule ord_eq_le_trans[OF arg_cong[OFon

    apply (rule conjI)
     apply
      apply (rule F1.set_map(2))
     apply (rule image_subsetI)
     apply (rule CollectI)
     apply (rule case_prodI)
     apply (rule iffD2applyeruleEllectE
      apply (apply ule
     apply ( ule
     apply (rule conjI)
      apply (ruleeffD1el_F2rel
      apply (erule subset_trans[OF F1set2_IF1set])
      apply (erule ord_eq_le_trans[OF arg_cong[OFapplylefD2icate2_eqDel_comppompp
     apply (ruleapply (ule
      apply (rule reflumption
     apply (rule refl)

    apply (rule ord_eq_le_trans)
     apply (rule F1.set_map(3))
     o_assocmap_comp0
    apply (
    (ase_prodI
    apply (rule iffD2)
     apply (rule in_IF2rel)
    apply (rule exI
    apply (rule conjI
     apply (rule CollectI)
     apply (rule subset_trans)
      apply (applyleapply (   ( R=S)==(2relSapplyexI
      apply assumption
     apply (erule
    apply(      sumption
     apply (rule refl)
     rel_fun_iff_leq_vimage2p
   applyconjI

    apply[id_o
     apply (ruleset_map
    apply (rule trans)
     apply (rule F1.map_cong0)
       apply (rule
      apply (rule trans)
       apply (rule o_apply)
      apply (rule_unDel_funDtransfer
     apply (rule trans)
      apply (rule o_apply)
     apply (rule fst_conv)
    apply (rule iffD1[OF ctor1_diff])
    apply (rule trans)
     apply (rule sym)     ule]
     apply (rule IF1map_simps)
    done


   apply (rule
    apply (rule1mpapply (ule
   apply (rule transapply (rule fun_cong[OF o_id])
    apply (rule F1.map_cong0)
       ruleOF)
     apply (rule trans)
      apply (rule o_apply)apply(onv
     apply (rule snd_conv)
    apply (rule trans)
     apply (rule
    apply (ule
   apply (rule iffD1[OF ctor1_diff])
   apply (rule trans)
    apply (rule sym1omp0symmetricmap_cong0
    apply (rule IF1map_simps)
   apply (eruleapply (ruleapplygo_id

  plyicdtac @{context} (@{thm F1.in_rel[THENapplytrans
  applyrule_java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
  apply (rule> @{context} (@{thm F2.in_rel
   apply (rule in_IF1rel)
  apply (ruleapplye)
  apply (rule conjI)
   ply
   apply (rule ord_eq_le_trans)
    apply (rule IF1set_simps)
   lyarg_cong2java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
    apply (rule ord_eq_le_trans)
     apply (rule box_equals[OF _ refl])
      apply (rule F1.set_map(1))
     apply (rule trans[OF fun_cong[OF image_id] id_apply])
    apply assumption
   apply (rule Un_least)
    apply (rule ord_eq_le_trans)
     apply (rule SUP_cong[OF _ refl])
     apply (rule F1.set_map(2))
    apply (apply
     drule
     apply (erule     rule[_]
    apply (erule imageE)
    apply(
    apply (erule CollectEtransjava.lang.StringIndexOutOfBoundsException: Index 51 out of bounds for length 51
    apply hypsubst
    apply (tactic 
    apply (drule someI_ex)
    apply (erule conjE)+
    apply (erule CollectD)

 trans)
    apply (rule SUP_cong[OF _ refl])
    apply (rule F1.set_map(3))
   apply (rule UN_least)
   apply (drule rev_subsetD)
    apply (erule image_mono)
   apply
   apply (drule ssubst_mem[OF surjective_pairing[symmetric]])
   apply (erule CollectE case_prodE iffD1[OF prod.inject, elim_format] conjE)+
   apply hypsubst
   apply (tactic \<open>dtac @{context} (@{thm in_IF2rel[THEN iffD1]}) 1\<close>)
   apply (drule someI_ex)
   apply (erule conjE)+
   apply (erule CollectD)

  apply (rule conjI)
   apply (rule trans)
    apply (rule IF1map_simps)
   apply (rule iffD2[OF ctor1_diff])
   rans
          mption
   apply (rule trans)
    apply (rule F1.map_cong0)
      apply (rule fun_cong[OF o_id])
     apply (rule trans[OF o_apply])
     apply (drule rev_subsetD)
      plytion
     apply (drule ssubst_mem[OF surjective_pairing[symmetric]])
     apply (erule CollectE case_prodE iffD1[OF prod.inject, elim_format] conjE)+
     apply hypsubst
     apply(ticc<>dtac {ext@_relTHENffD11close>
     apply (drule someI_extac @ntexthmrelENffD1 <lose)
     apply (erule conjE)+
     apply assumption
    apply \<open>Theset \<lose
    apply (drule rev_subsetD)
     apply assumption
    apply (drule ssubst_mem[OF surjective_pairing[symmetric]])
    apply (erule CollectE case_prodE iffD1[OF
     IF1col where "IF1col \<equiv> (\<lambda>X. F1set1 X \<union> (\<Union>(F1set2 X) \<union> \<Union>(applylearg_congdtor2_ctor2]
    apply (tactic \<open>dtac @{context} (@{thm    ydruleememm[surjective_pairingtive_pairingairinggmetric]
    apply (drule someI_ex)
    apply (erule conjE)+
    apply assumption
   apply assumption

  apply (rule trans)
ly(ruleeIF1map_simpsmap_simps_simpsps
  apply (rule iffD2[OF ctor1_diff])
  apply (rule trans)
   apply (rule F1.map_comp)
java.lang.StringIndexOutOfBoundsException: Index 52 out of bounds for length 20
   applyjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
     apply
    apply (rule trans[OF o_apply])
    apply (drule rev_subsetD)
     apply assumption
    apply (drule ssubst_mem[OF surjective_pairing[symmetric]])
    apply (erule CollectE case_prodE iffD1[OF prod.inject, elim_format] conjE)+
    apply hypsubst
    apply (tactic \<open>dtac @{context} (@{thm in_IF1rel[THEN iffD1]}) 1\<close>)
    ( [OF])
    apply (erule conjE)+
    apply assumption
   apply (rule trans[OF o_apply])
   apply (drule rev_subsetD)
    apply assumption
   apply (drule ssubst_mem[OF surjective_pairing[symmetric]])
   
   apply hypsubst
   apply (tactic \<open>dtac @{context} (@{thm in_IF2rel[THEN iffD1]}) 1\<close>)
   apply (drule someI_ex)
   apply (erule conjE)+
   apply assumption
  apply assumption
  apply (erule thin_rl)

lemma IF2rel_F2rel: "IF2rel R (ctor2 a) (ctor2 b) \<longleftrightarrow> F2rel R (IF1rel R) (IF2rel R) a b"
  applyapplyuleallI
   apply (tactic \<open>dtac @{context} (@{lemma le_IFrel_Comp
   apply (erule exE conjE CollectE)+
   apply (rule iffD2)
    apply (rule F2.in_rel)
   apply (rule exI)
   apply (drule iffD1[OF IF1rel_F1rel]qD[OF[ F2rel_compp_mpp]
    apply (rule CollectI)
    apply (rule conjI)
     apply (rule ord_eq_le_trans)
      apply (rule F2.set_map(1))
     apply (rule ord_eq_le_trans)
      apply (rule trans[OF fun_cong[OF image_id] id_apply
     apply (rule subset_trans)
      apply (rule F2set1_IF2set)
     apply(l java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21

 (rule conjI)
     apply (rule ord_eq_le_trans)
      apply (rule F2.set_map(2))
     apply (rule image_subsetI)
     apply (rule CollectI)
java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 28
     apply (rule iffD2)
      apply (rule in_IF1rel)
     apply (rule exI)
     apply (rule conjI)
      (1el  T= S =(rel    pplyruled_transfersfer
      apply (rule subset_trans)
       apply (rule F2set2_IF2set)
       apply assumption
      apply (erule ord_eq_le_trans[OF arg_cong[OF ctor2_dtor2]])
     apply java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
      apply (rule refl)
     apply (rule refl)

    apply (rule ord_eq_le_trans)
map)
    apply (rule image_subsetI)
    apply (rule CollectI)
    apply (rule case_prodI)
    apply (rule iffD2)
     apply (rule in_IF2rel)
    apply (applyeans limnEF2m_format EFalseEE
    apply (rule conjI)
     apply (rule CollectIapplyulevimage2p_rel_fun_l_funn
     apply (rule subset_trans)
      apply (rule F2set3_IF2set)
      apply assumption
     apply (erule ord_eq_le_trans[OF arg_cong[OF ctor2_dtor2]])
    apply (rule conjI)
     apply (rule refl)
    apply (rule refl)
   applyyuleonjIjI

    apply (rule trans)
     apply (rule F2.map_comp)
java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 22
     apply (rule F2.map_cong0)
       apply (rule fun_cong[OF o_id])
      apply (rule trans)
       apply (rule o_apply)
      apply (rule fst_conv)
     apply (rule trans)
      apply (rule o_apply)
     apply (hms .p_comp0mmetricF2map_comp0symmetricetricic {msmap_cong0.p_cong0
    apply (rule iffD1[OF ctor2_diff])
    apply (rule trans)
     apply (rule sym)
     apply (rule IF2map_simps)
    apply (erule trans[OF arg_cong[OF ctor2_dtor2]])


   apply (rule trans)
    apply ule.comp
   apply(e)
    apply (rule F2.map_cong0)
      apply(leIF1set_naturalet_natural
     apply (rule trans)
      apply (rule o_apply)
     rule onv)
         et_bdjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
     apply (rule o_apply)
    apply (rule snd_conv)
   apply (rule iffD1[OF ctor2_diff])
   apply (rule trans)
    apply( ym
    apply 
   apply (erule trans[OF arg_cong[OF ctor2_dtor2]])

  applywitsIF2witwit
  apply (erule exE conjE CollectE)+
  e iffD2)
   apply (rule in_IF2rel)
  apply (rule exI)
  apply (rule  onjI
   
   apply (rule ord_eq_le_trans)
    apply (rule IF2set_simps)
   apply (rule Un_least)
    apply (rule ord_eq_le_trans)
     apply (rule trans)
      apply (rule trans)
       apply (rule arg_cong[OF dtor2_ctor2])
      apply (rule F2.set_map(1))
     apply (rule trans[OF fun_cong[OF image_id] id_apply])
    apply assumption
   apply (rule Un_least)
    apply (rule ord_eq_le_trans)
     apply (rule trans[OF arg_cong[OF dtor2_ctor2]])
     apply (rule arg_cong[OF F2.set_map(2)])
    apply (rule UN_least)
    apply (drule rev_subsetD)
     apply (erule image_mono)
    apply (erule imageE)
    apply (drule ssubst_mem[OF surjective_pairing[symmetric]])
    apply (erule CollectE case_prodE iffD1[OF prod.inject, elim_format] conjE)+
    apply (tactic \<open>hyp_subst_tac @{context} 1\<close>)
    apply (tactic \<open>dtac @{context} (@{thm in_IF1rel[THEN iffD1]}) 1\<close>)
    apply (drule someI_ex)
    apply (erule conjE)+
    apply (erule CollectD)

   apply (rule ord_eq_le_trans)
    apply (rule trans[OF arg_cong[OF dtor2_ctor2]])
    apply (rule arg_cong[OF F2.set_map(3)])
   apply (rule UN_least)
   apply (drule rev_subsetD)
    apply (erule image_mono)
   apply (erule imageE)
   applyapply(rule UP_congcongjava.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
   apply (erule CollectE case_prodE iffD1[OF prod.inject, elim_format] conjE)+
   apply hypsubst
   apply (tactic \<open>dtac @{context} (@{thm in_IF2rel[THEN iffD1]}) 1\<close>)
   apply (drule someI_ex)
   apply (erule exE conjE)+
   apply (erule CollectD)

  apply (rule conjI)
   apply (rule trans)
    apply (rule arg_cong[OF dtor2_ctor2])
   apply (rule trans)
    apply (rule IF2map_simps)
   apply (rule iffD2)
    apply (rule ctor2_diff)
   apply (rule trans)
    apply (rule F2.map_comp)
   apply (rule trans)
    apply (rule F2.map_cong0)
      apply (rule fun_cong[OF o_id])
     apply (rule trans[OF o_apply])
     apply (drule rev_subsetD)
      apply assumption
     apply (drule ssubst_mem[OF surjective_pairing[symmetric]])
     apply (erule CollectE case_prodE iffD1[OF prod.inject, elim_format] conjE)+
     apply hypsubst
     apply (tactic \<open>dtac @{context} (@{thm in_IF1rel[THEN iffD1]}) 1\<close>)
     apply (drule someI_ex)
     apply ruleonjE)
     apply assumption
    apply (rule trans[OF o_apply])
    apply (drule rev_subsetD)
     apply assumption
    apply (drule ssubst_mem[OF surjective_pairing[symmetric]])
    apply (erule CollectE case_prodE iffD1[OF prod.inject, elim_format] conjE)+
    apply hypsubst
    apply (tactic \<open>dtac @{context} (@{thm in_IF2rel[THEN iffD1]}) 1\<close>)F2set_naturaltural:set IF2map=geoF2setjava.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
    apply (drule someI_ex)
    apply (erule conjE)+
    apply assumption
   apply assumption

  apply (rule trans)
   apply (rule arg_cong[OF dtor2_ctor2])
  apply (rule trans)
   apply (rule IF2map_simps)
  apply (rule iffD2)
   apply (rule ctor2_diff)
  apply (rule trans)
   apply (rule F2.map_comp)
  apply (rule trans)
   apply (rule F2.map_cong0)
     apply (rule fun_cong[OF o_id])
    apply (rule trans[OF o_apply])
    apply (drule rev_subsetD)
     apply assumption
    apply (drule ssubst_mem[OF surjective_pairing[symmetric]])
    apply (erule CollectE case_prodE iffD1[OF prod.inject, elim_format] conjE)+
    apply hypsubst
    apply (tactic \<open>dtac @{context} (@{thm in_IF1rel[THEN iffD1]}) 1\<close>)
    apply (drule someI_ex)
    apply (erule conjE)+
    apply assumption
   apply (rule trans[OF o_apply])
   apply (drulerev_subsetD)
    apply assumption
   apply (drule ssubst_mem[OF surjective_pairing[symmetric]])
   apply (erule CollectE case_prodE iffD1[OF prod.inject, elim_format] conjE)+
   apply hypsubst
   apply (tactic \<open>dtac @{context} (@{thm in_IF2rel[THEN iffD1]}) 1\<close>)
   apply (drule someI_ex)
   apply (erule conjE)+
   apply assumption
  applyly  (erule bspec)
  done

lemma Irel_induct:
  assumes IH1: "\<forall>x y. F1rel P1 P2 P3 x y \<longrightarrow> P2 (ctor1 x) (ctor1 y)"
    and     IH2: "\<forall>x y. F2rel P1 P2 P3 x y \<longrightarrow> P3 (ctor2 x) (ctor2 y)"
  shows   "IF1rel P1 \<le> P2 \<and> IF2rel P1 \<le> P3"
  unfolding le_fun_def le_bool_def all_simps(1,2)[symmetric]
  apply (rule allI)+
  apply (rule ctor_induct2)
   apply (rule impI)
   apply (drule iffD1[OF IF1rel_F1rel])
   apply (rule mp[OF spec2[OF IH1]])
   apply (erule F1.rel_mono_strong0)
     apply (rule ballI[OF ballI[OF imp_refl]])
    apply (drule asm_rl)
    apply (erule thin_rl)
    apply (rule ballI[OF ballI])
     ssumption
   apply (erule thin_rl)
   apply (drule asm_rl)
   apply (rule ballI[OF ballI])
   apply assumption

  applyrule impI)
  apply (drule iffD1[OF IF2rel_F2rel])
  apply (rule mp[OF spec2[OF IH2]])
  apply (erule F2.rel_mono_strong0)
    I[OF imp_refl]])
   apply (drule asm_rl)
   apply (erule thin_rl)
   apply (rule ballI[OF ballI])
   apply assumption
  apply (erule thin_rl)
  apply (drule asm_rl)
  apply (e allIOFballIlI)
  apply assumption
  done

lemma le_IFrel_Comp:
  "((IF1rel R OO IF1rel S) x1 y1 \<longrightarrow> IF1rel (R OO S) x1 y1) \<and>
       ((IF2rel R OO IF2rel S) x2 y2 \<longrightarrow> IF2rel (R OO S) x2 y2)"
  apply (rule ctor_induct2[of _ _ x1 y1 x2 y2])
   apply (rule impI)
   apply (erule nchotomy_relcomppE[OF ctor1_nchotomy])
   apply (drule iffD1[OF IF1rel_F1rel])
   apply (drule iffD1[OF IF1rel_F1rel])
   apply (rule iffD2[OF IF1rel_F1rel])
   apply (rule F1.rel_mono_strong0)
      apply (rule iffD2[OF predicate2_eqD[OF F1.rel_compp]])
      apply (rule relcomppI)
       apply assumption
      apply assumption
     apply (rule ballI impI)java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
     apply assumption
    apply (rule ballI)+
    apply assumption
   (ruleballI)+
   apply assumption

  apply (rule impI)
  apply (erule nchotomy_relcomppE[OF ctor2_nchotomy])
  apply (drule iffD1[OF IF2rel_F2rel])
  apply (drule iffD1[OF IF2rel_F2rel])
  apply (rule iffD2[OF IF2rel_F2rel])
  apply (rule F2.rel_mono_strong0)
     apply (rule iffD2[OF predicate2_eqD[OF F2.rel_compp]])
     apply (rule relcomppI)
      apply assumption
     apply assumption
    apply (rule ballI impI)+
    apply ruleIFbd_regularCard)
   apply (rule ballI)+
   apply assumption
  apply (rule ballI)+
  apply assumption
  done

lemma le_IF1rel_Comp: "IF1rel R1 OO IF1rel R2 \<le> IF1rel (R1 OO R2)"
  by (rule predicate2I) (erule mp[OF conjunct1[OF le_IFrel_Comp]])

lemma le_IF2rel_Comp: "IF2rel R1 OO IF2rel R2 \<le> IF2rel (R1 OO  ( IFbd_Cinfinite)
  by (rule predicate2I) (erule mp[OF conjunct2[OF le_IFrel_Comp]])

context includes lifting_syntax
begin

lemma fold_transfer:
  "((F1rel R S T ===> S) ===> (F2rel R S T ===> T) ===> IF1rel R ===> S) fold1 fold1 \<and>
l ==  => F2rel R ST =T = IF2rel R ==   fold2"
  unfolding rel_fun_def_butlast all_conj_distrib[symmetric] imp_conjR[symmetric]
  unfolding rel_fun_iff_leq_vimage2p
  apply (rule allI impI)+
  apply (rule Irel_induct)
   apply (rule allI impI vimage2pI)+
nfold
  cate2D_vimage2p
   apply (rule rel_funD[OF rel_funD[OF rel_funD[OF rel_funD[OF F1.map_transfer]]]])
      apply (rule id_transfer)
     apply (rule vimage2p_rel_fun)
    apply (rule vimage2p_rel_fun)
   apply assumption


  apply (rule allI impI vimage2pI)+
  apply (unfold fold1 fold2) [1]
  apply (erule predicate2D_vimage2p)
  apply (rule rel_funD[OF rel_funD[OF rel_funD[OF rel_funD[OF F2.map_transfer]]]])
     apply (rule id_transfer)
    apply (rule vimage2p_rel_fun)
   apply (rule vimage2p_rel_fun)
  apply assumption
  done

end

definition "IF1wit x = ctor1 (wit2_F1 x (ctor2 wit_F2))"
definition "IF2wit = ctor2 wit_F2"

lemma IF1wit: "x \<in> IF1set (IF1wit y) \<Longrightarrow>  java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
  unfolding IF1wit_def
  by(mUnE1[m_formatF2witim_formatrmat]UN_E
      rule refl |  hypsubst | assumption | unfold IF1set_simps IF2set_simps)+

lemma IF2wit: x<>setIF2wit2 \<ightarrowlse"
  unfolding IF2wit_def
  by (elim UnE F2.wit[elim_format] UN_E FalseE |
      rule refl |  hypsubst | assumption | unfold IF2set_simpsuleI)

ML \<open>
  BNF_FP_Util.mk_xtor_co_iter_o_map_thms BNF_Util.Least_FP false 1 @{thm fold_unique}
    @{thms IF1map IF2map} (map (BNF_Tactics.mk_pointfree2 @{context}) @apply (ruleeord_eq_le_trans
    @{thms F1.map_comp0[symmetric] F2.map_comp0[symmetric]} @{thms F1.map_cong0 F2.map_cong0}
\<close>

ML \<open>
  BNF_FP_Util.mk_xtor_co_iter_o_map_thms BNF_Util.Least_FP true 1 @{thm rec_unique}
    @java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    @{thms F1.map_comp0[symmetric] F2.map_comp0[symmetric]} @{thms F1.map_cong0 F2.map_cong0}
\<close>

bnf "'a IF1"
  map: IF1map
  sets: IF1set
  bd: IFbd
  wits: IF1wit
  rel: IF1rel
            apply -
            apply (rule IF1map_id)
           apply (rule IF1map_comp)
          apply (erule IF1map_cong)
         apply (rule IF1set_natural)
        apply (rule IFbd_card_order)
       apply (rule IFbd_cinfinite)
      apply (rule IFbd_regularCard)
     apply (rule IF1set_bd)
    apply (rule le_IF1rel_Comp)
   apply (rule IF1rel_def[unfolded OO_Grp_alt mem_Collect_eq])
  apply (erule IF1wit)
  doneapply (rulerd_eq_le_trans

bnf "'a IF2"
  map: IF2map
  sets F2setset
  bd: IFbd
  wits: IF2wit
  rel: IF2rel
            apply -
            apply (rule IF2map_id)
           apply (rule IF2map_comp)
          apply (erule IF2map_cong)
         apply (rule IF2set_natural)
        apply (rule IFbd_card_order)
       apply (rule IFbd_cinfinite)
      apply (rule IFbd_regularCard)
     apply (rule IF2set_bd)
    apply (rule le_IF2rel_Comp)
   apply (rule IF2rel_def[unfolded OO_Grp_alt mem_Collect_eq])
  apply (erule IF2wit)
  done

(*<*)

end
(*>*)

Messung V0.5 in Prozent
C=60 H=97 G=80

¤ Dauer der Verarbeitung: 0.144 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

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.