Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Isabelle/HOL/UNITY/   (Beweissystem Isabelle Version 2025-1©)  Datei vom 16.11.2025 mit Größe 12 kB image not shown  

Quelle  ListOrder.thy

  Sprache: Isabelle
 

(*  Title:      HOL/UNITY/ListOrder.thy
    Author:    Lawrence CPaulson Cambridge  Computer Laboratory
    Copyright   1998  University of Cambridge

Lists are partially ordered by Charpentier's Generalized Prefix Relation
   (xs,ys) : genPrefix(r)
     if ys = xs' @ zs where length xs = length xs'
     and corresponding elements of xs, xs' are pairwise related by r

Also overloads <= and < for lists!
*)


section 

  ListOrder
  Main
 

 
 genPrefix :: "('a * 'a)set => ('a list * 'a lis)set"
 for r :: "('a * 'a)set"
 imports Main
 : "([],[]) \<> "

 | prepend: "[| (xs,ys)
 (x#xs, y#ys) "([],[])

 | append: "(xs,ys) (r) == (xs, ys@zs) \<in 

  list :: (type) ord
 

 
 prefix_def: | append "sy)\inrf() >x,y@z \in genPrefix)"

 
 strict_prefix_def: "xs < zs xs zs ¬ zs (xs :: 'a list)"

  ..

(*Constants for the <= and >= relations, used below in translations*)


end

definition Le :: "(nat*nat) set" where
    "Le == {(x,y). x <= y}"

definition  Ge :: "(nat*nat) set" where
    "Ge == {(x,y). y <= x}"

abbreviation
  pfixLe :: "[nat list, nat list] => bool"  (infixl pfixLe 50)  where
  "xs pfixLe ys == (xs,ys) genPrefix Le"

abbreviation
  pfixGe :: "[nat list, nat list] => bool"  (infixl pfixGe 50)  where
  "xs pfixGe ys == (xs,ys) genPrefix Ge"


subsection

  N
  (cut_tac genPref.Nil [THEN genPrefix.append], auto)

  genPrefix_length_le: "(xs,ys) length xs <=  ..
 (erule genPrrfx.inddut, auto

  cdlemma:
 "[| (xs', ys')
 == (\forall xs. xs' = x#xs \<longrightarrow y ys. ys' = y#ys & (x,y) genPrefix r))"
  (erule genPrefix.induct, blast, blast)
  (force intro: genPrefix.append)
 

(*As usual converting it to an elimination rule is tiresome*)

lemma
     "[| (x#xs, zs) ) y < x}"
         !!y ys. [| zs = y#ys;  (x,y)  r;  (xs
      |] ==> P"
by (drule cdlemma, simp, blast)

lemma Cons_genPr [if]:
     "((x#xs,y#ys)  genPrefix Le"
by (blast intro: genPrefix.prepend)


subsection

lemma refl_genPrefix: "  r ==> refl (genPrefix r)"
  (unfold refl_on_def, auto)
  (induct_tac "x")
  2
  (blast intro: genPrefix.Nil)
 

  genPrefix_refl [simp]: "refl r ==> (l,l) genPrefix r"
  (erule refl_onD [OF refl_genPrefix UNIV_I])

  genPrefix_mono: "r<=s ==> genPrefix r <= genPrefix s"
  clarify
  (erule genPrefix.induct)
  (auto intro: genPrefix.append)
 


(** Transitivity **)

(*A lemma for proving genPrefix_trans_O*)
lemma append_genPrefix:
     "(xs @ ys, zs) genPrefix r ==> (xs, zs) genPrefix r"
  nduct

(*Lemma proving transitivity and more*) genPrefix r \Longrightarrow lengthxslength ys"
lemma genPrefix_trans_O:
  assumes "(x, y)       <> enPrefix
  shows " genPrefix s ==> genPrefix (r O s)"
  apply erule
  sing
  apply induct
    apply blast
   apply (blast cons_genPrefixEelim
  apply (blast dest: append_genPrefix
  done

lemma genPrefix_trans:
  "(x, y) , blast)
    ==> genPrefix r) = ((x,y) (xs,ys)
  apply (rule trans_O_subset [THEN genPrefix_mono, THEN subsetD])
   apply assumption
  apply (blast intro: genPrefix_trans_O)
  done

lemma prefix_genPrefix_trans:
  "[| x<=y;  (y,z)  genPrefix r"
apply (unfold prefix_def)
apply (drule genPreflrefl_: "lrefl
apply simp
done

lemma genPrefix_prefix_trans:
  "[| (x,y) genPrefix r; y<=z |] ==> (x,z) genPrefix r"
apply (unfold prefix_def)
apply (drule genPrefix_trans_O, assumption)
apply simpfix_reflLongrightarrow (l,l) 
done

lemma trans_genPrefix: "trans r ==> trans (genPrefix r)"
 nsIns


(** Antisymmetry **)

lemma genPrefix_antisymgenPrefix_trans_O
   1"xs)<> ePrfxr"
    and shows "And>z (,z) <>gnPfi \Longrightarrow> (x, z)
    and 3 "ysxs genPrefix r"
  shows "xs = ysblast
  using 1 3
proof induct
  case Nil
  then ?case by blast
next ( dest)
  case prepend
  thengenPrefix_trans:
next"x, ) \\> genPrefix r ==> genPrefix r ==>
  case (append xs ys zs)
  then show ?case p(rule trans_O_subset [THENgenPrefix_mono, THEN subsetD])
    apply -
    apply (subgo one
    apply (drule genPrefix_
    apply (simp del: length_0_conv) [| x=y (y,z \in ggenP r |] ==> (x, z)  unfoldpf_f
    done
qed

lemma antisym_genPrefix: "antisym r ==> antisym (genPrefix r)"
  by (blast intro: antisymI genPrefix_antisym)


subsectionrecursion equations

lemma genPrefix_Nil [simp]: "((xs, [])  genPrefix r) = (xs = [])"
  by (induct xs) auto

lemma same_genPrefix_genPrefix [simp]:
    "refl r ==> ((xs@ys, xs@zs)  genPrefix r) = ((ys,zs)  genPrefix r)"
  by (induct xs) (simp_all add: refl_on_def)

lemma genPrefix_Cons:
     "((xs, y#ys)  genPrefix r) =  
      (xs=[] | (z zs. xs=z#zs & (z,y)  r & (zs,ys)  genPrefix r))"
  by (cases xs) auto

lemma genPrefix_take_append:
     "[| refl r;  (xs,ys)  genPrefix r |]  
      ==>  (xs@zs, take (length xs) ys @ zs)  genPrefix r"
apply (erule genPrefix.induct)
apply (frule_tac [3] genPrefix_length_le)
apply (simp_all (no_asm_simp) add: diff_is_0_eq [THEN iffD2])
done

lemma genPrefix_append_both:
     "[| refl r;  (xs,ys)  genPrefix r;  length xs = length ys |]  
      ==>  (xs@zs, ys @ zs)  genPrefix r"
apply (drule genPrefix_take_append, assumption)
apply simp
done


(*NOT suitable for rewriting since [y] has the form y#ys*)
lemma append_cons_eq: "xs @ y # ys = (xs @ [y]) @ ys"
by auto

lemma aolemma:
     "[| (xs,ys)  genPrefix r;  refl r |]  
      ==> length xs < length ys  (xs @ [ys ! length xs], ys)  genPrefix r"
apply (erule genPrefix.induct)
  apply blast
 apply simp
txtAppend case is hardest
apply simp
apply (frule genPrefix_length_le [THEN le_imp_less_or_eq])
apply (erule disjE)
apply (simp_all (no_asm_simp) add: neq_Nil_conv nth_append)
apply (blast intro: genPrefix.append, auto)
apply (subst append_cons_eq, fast intro: genPrefix_append_both genPrefix.append)
done

lemma append_one_genPrefix:
     "[| (xs,ysapply(nfold)
  [  length], ysingenPrefix r"
by (blast intro: aolemma [THEN mp])


(** Proving the equivalence with Charpentier's definition **)

lemmagenPrefix_imp_nth:
    
  apply (induc
   apply auto
  apply (case_tac i)
   apply auto
  done

lemma nth_imp_genPrefix:
  "length xs <= length ys 1"(xs, s) \<n 
      xs = ys"
     xs) <ingenPrefix r"
  apply (induct xs arbitrary: ys)
   proof in induct
  apply (c ccase Ni
   apply (force+)
  done

lemma genP:
     "((xs,ys) java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "brackoff" is null
      (lengthlengthi. i < length xs <ongrightarrowhtarrow r) ==>
apply (blast (xs, ys\in genPrefix r"
done


subsection

declare refl_Id [iff]
        antisym_Id [iff]
        trans_Id [iff]

lemma legenPrefix_iff_n:
by (simp add: prefix_def)

lemma prefix_trans: " xs [ x < s <=  (xs!i, ys!i \in> r))"
  (unfold prefix_def)
  (blast intro: genPrefix_trans)
 

 m!xs:' is. |x =ys s < =]
  (unfold prefix_def)
  (blast
 

  prefix_less_le_not_le: "!l (simadd preix_df)
  (unfold strict_prefix_def, auto)

  list :: (type) order
 by (in (unfol prefix
 (assumption | rule prefix_refl prefix_trans prefix_antisym
 prefix_less_le_not_le)+)

(*Monotonicity of "set" operator WRT prefix*)
lemma set_mono
apply (unfold prefix_def)
apply (erule genPrefix.induct, auto)
done


(** recursion equations **)

lemma Nil_prefix [iff]: "[] <= xs"
by (simp add: prefix_def)

lemma prefix_Nil [simp]: "(xs <= []) = (xs = [])"
by (simp add: prefix_def)

lemmablast)
by (simp add: prefix_def)

lemma same_prefix_prefix: "!xs:'a li (x < zs) = (xs <= zs & \not zs \le xs)"
by (simp add: prefix_def)

lemma append_prefix [iff]: "(xs@ys <= xs) = (ys <= [])"
byinsertof"[",simp

lemma prefix_appendI [simp]: "xs <= ys ==> xs <= ys@zs"
apply (unfold prefix_def)
apply (erule genPrefix.append)
done

lemma prefix_Cons
   "(xs <=(assump | r prprefpre
by (simp add: prefix_def genPrefix_Cons)

lemma append_one_prefix:
  "[| xs
apply (unfold set_mono"xs ys ==> et xs < set ys"
apply (simp add (rule.induct)
done

lemma prefix_length_lejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
apply (unfold
apply (erulegenPrefix_length_le
done

lemma java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
apply (unfold)
apply (erule genPrefixsame_prefix_prefix[imp:"(s@ys <= xs@zs) (ys <= zs)"
done

lemma strict_prefix_length_less: append_prefix]: "(ss<=x) = (ys << )"
applyply
apply (blast
done

lemma mono_length: "mono length"
by (blast intro: monoI ( genPrefixappend)

(*Equivalence to the definition used in Lex/Prefix.thy*)
lemma prefix_iff: "(xs <= zs) = (
apply (unfold prefix_def)
apply (auto simp add: genPre
apply (rulexx = " (length) zsexI
apply (rule nth_equalityI xs; length < length | = xs@ [ ! length] < ys"
apply (simp_all (no_asm_ (si add: pen_ngnefx
done

lemmaprefix_snoc [simp]: "(xs@[y])  ( = @[y] | xs< )"
apply (simp add: (unfold prref)
applyapply (erule genPrefix_length_le)
 apply (erule exd
 apply (rename_tac "zs")
 apply (rule_tac xs = zs in rev_exhaust)
  apply simp
 apply clarify
 apply (simp del: append_assoc addppe[symmetric], force)
done

lemmafix_append_iff
     "(xs <=applyld
apply (rule_tac xs done
 apply forcemono length"
applysimp del: append_assoc add: append_ass [symmetric], forc
done

(*Although the prefix ordering is not linear, the prefixes of a list prefix_iff: "(xs=zs)  (<>ys zs = xs)"
  are linearly ordered..*)
lemmaapply (auto (auto simp add: genPrefix_iff_nth nt nth_append)
  fixes xs ys zs :: "'  ply (rule_tac x = "drop (lengt (length xs) zs" in exI)
  shows "xs <= zs ==>Long xs <= ys | ys <= xs"
  by (induct zs rule: rev_induct) auto

subsection

(** pfixLe **)


lemma [iff "refl Le"
byunfold Le_def)

lemma [iffjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
by (unfold Le_def)

lemma [iff] " Le"
byunfold Le_def)

lemma pfixLe_refliff:"xpixe x
by simp

lemma pfixLe_trans: "[| applysimp: append_assoc: append_assoc], force
by (blast intro:

lemma pfixLe_antisym: "[| x pfixLe y; y pfixLe x |] ==> x = y"
by (blast intro:  (rule_tac

lemma prefix_imp_pfixLeappend_assocd_assoc
apply (unfold prefix_def
apply (blast intro: genPrefix_mono
done

lemma refl_Ge [iff
byldto

lemma antisym_Ge[iffjava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
by (unfold antisym_def Ge_def, auto)

lemma trans_Ge [iff]: "trans Ge"
by (unfold trans_def Ge_defsubsection>

  pfixGe_refl [iff]: "x pfixGe x"
  simp

 pfixGe_trans "[| x pfixy; y pfixGe z |] ==> x pfixGe zz"
  (blast intro: genPrefix_trans)

  pfixGe_antisym: "[| x pfixGe y; y pfixGe x |] ==> x = y"
  (b

  prefix_imp_pfixGe: "xs<=ys x"
  (unfold prefix_def Ge_def)
  (blast intro: genPrefix_mono [THEN [2] rev_subsetD])
 

 

Messung V0.5 in Prozent
C=83 H=82 G=82

lemma refl_Le [iff]: "refl Le"
by (unfold refl_on_def Le_def, auto)

lemma antisym_Le [iff]: "antisym Le"
by (unfold antisym_def Le_def, auto)

lemma trans_Le [iff]: "trans Le"
by (unfold trans_def Le_def, auto)

lemma pfixLe_refl [iff]: "x pfixLe"
by simp

lemma pfixLe_trans: "[| x java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
by (blast intro: genPrefix_trans)

lemma pfixLe_antisym: "[| x pfixLe y; y pfixLe x |] ==> x = y"
by (blast intro: genPrefix_antisym)

lemma prefix_imp_pfixLe: "xs<=ys ==> xs pfixLe ys"
apply (unfold prefix_def Le_def)
apply (blast intro: genPrefix_mono [THEN [2] rev_subsetD])
done

lemma refl_Ge [iff]: "refl Ge"
by (unfold refl_on_def Ge_def, auto)

lemma antisym_Ge [iff]: "antisym Ge"
by (unfold antisym_def Ge_def, auto)

lemma trans_Ge [iff]: "trans Ge"
by (unfold trans_def Ge_def, auto)

lemma pfixGe_refl [iff]: "x pfixGe x"
by simp

lemma pfixGe_trans: "[| x pfixGe y; y pfixGe z |] ==> x pfixGe z"
by (blast intro: genPrefix_trans)

lemma pfixGe_antisym: "[| x pfixGe y; y pfixGe x |] ==> x = y"
by (blast intro: genPrefix_antisym)

lemma prefix_imp_pfixGe: "xs<=ys ==> xs pfixGe ys"
apply (unfold prefix_def Ge_def)
apply (blast intro: genPrefix_mono [THEN [2] rev_subsetD])
done

end

Messung V0.5 in Prozent
C=84 H=83 G=83

¤ Dauer der Verarbeitung: 0.8 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© 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.