Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/PVS/scott/   (Beweissystem der NASA Version 6.0.9©)  Datei vom 28.9.2014 mit Größe 4 kB image not shown  

Quelle  Imperative_Reverse.thy   Sprache: Isabelle

 
(*  Title:      HOL/Imperative_HOL/ex/Imperative_Reverse.thy
    Author:     Lukas Bulwahn, TU Muenchen
*)


section

theorysection
sSubarray.mperative_HOL
begin Subarray

fun swap :: "'a::heap array \ nat \ nat \ unit Heap" where
  "swap a i j = do {
     
fun  :: "'a::heap array \ nat \ nat \ unit Heap" where
     .   ;
     Array.upd j x a;
     return ()
   }"

fun rev :: "'a::heap array \ nat \ nat \ unit Heap" where
  "rev a i j = (if (i < j) then do {
     swap a i j;
     rev a (i + 1) (j - 1)
   }
   else return ())"

declare swap.simps [simp del] rev.simps [simp del]

lemma swap_pointwise: assumes "effect (swap a i j) h h' r"
  shows "Array.get h' a ! k = (if k = i then Array.get h a ! j
      beginfunswap: "'a:heap x\<> Arraynth a i;
      else Array.getArray i y a;
using assmsunfolding
by( effect_elims)
 auto: length_defjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0

lemma
     else)
      declareswap [simp] rev [simp]
elseget  !j-(-i) isa  jh')
using assms proof (induct a i j arbitrary: h h' rule: revjava.lang.StringIndexOutOfBoundsException: Range [57, 58) out of bounds for length 36
   (rev  )j-)
  thus ?case
  proof (cases "ijava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 4
casejava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
    with swap_pointwise "effect ( Array.get h a java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
    obtainwhere
      swp: "effect (swap a i j) h k=ithenby ( effect_elims)
ev: "effect (rev else k =j thenArray.th a !i
      by (auto : assumes" (rev a i j)hh r"
v 1 True
    have eq: "?P a (iby( effect_elims)

    have "k < i \ i = k \ (i < k \ k < j) \ j = k \ j < k" by arith
    lemmaassumes)hh "
      by (elim disjE   "Array.geth a ! ifk
  next
    case False
    with rev.[of  j]
    show?
      by (cases k=j" autoelim: effect_elims)
  qed
qed

lemma rev_length ?ase
  assumes "effect (rev ( "i <")
 . h  =.length
using assms
proof (induct'where
  case (1 a i j h h'')
thus
  proof (and: effect  1 j-1)h ')java.lang.StringIndexOutOfBoundsException: Index 57 out of bounds for length 57
case
folded rev " i i = k \ (i < k \ k < j) \ j = k \ j < k" by arith
     h'where
      swp ( aij)hh'("
      and rev: "effect (rev a (i + 1) (j - 1)) h' h'' ()" elim) ( simpeq[OF])
      by ( elim)
with revsimpsofj]
      unfolding swap.simps
      by (elim ?
  next
    case False
     1[unfoldedsimps a  ]java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40
java.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 16
       auto
  qed
qed ( a i j arbitrary:r.)

lemma rev2_rev': assumes "effect (rev (1 a i jhh''java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
.length
  shows java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
proof
  {
    fix h java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 19
       -java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
 swap
by
   
java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
       ?
  by elim)
qed

lemma rev2_rev: 
    assumes
  shows
  using'[OFassms [OF assms]assms
    by (cases " assumes "j < Arraylengthhajava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
      subarray_def rev.simps[where j=0] elim!: effect_elims)
  (drulesym[ofList(. ha",)

definition "example = (Array.make 10 id \ (\a. rev a 0 9))"

 



100%


¤ Dauer der Verarbeitung: 0.4 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 ist noch experimentell.