| fs = abs-files(files), ofh = abs-of(of), root.dir?, dom of < ino, abs(root, ROOT_INO)(dirs), afs-cons(dirs, files), fids-cons(root, abs-files(files), abs-of(of)), of-cons(of, dirs, files), n0 ≤ # buf, psynced → asynced, (err1 = ESUCCESS ⊃ (files0[of[fd].ino].content.stream to files0[of[fd].ino].size).buf = splice(buf, 0, (files[of[fd].ino].content.stream to files[of[fd].ino].size).buf, of[fd].pos, n1) ∧ fd ∈ of ∧ of0 = of[fd, of[fd].pos:= (of[fd].pos + n1)] ∧ n1 ≤ n0 ∧ of[fd].ino ∈ files ∧ of[fd].ino ∈ files0 ∧ files0[of[fd].ino].meta = files[of[fd].ino].meta ∧ files0 -- of[fd].ino = files -- of[fd].ino ∧ (of[fd].mode = MODE_W ∨ of[fd].mode = MODE_RW) ;files0 ~ files ∧ of = of0 ∧ (err1 = EBADFD ∧ (fd ∈ of0 → of0[fd].mode ≠ MODE_W ∧ of0[fd].mode ≠ MODE_RW) ∨ ⌊err1⌋ ) ) ⊦ ⟨posix_write#(fd, buf, user, root; n0, err0, fs, ofh; psynced)⟩ (ofh = abs-of(of0) ∧ fs = abs-files(files0) ∧ (psynced → asynced0) ∧ n1 = n0 ∧ err1 = err0) |
fs = abs-files(files), ofh = abs-of(of), root.dir?, dom of < ino, abs(root, ROOT_INO)(dirs), afs-cons(dirs, files), fids-cons(root, abs-files(files), abs-of(of)), of-cons(of, dirs, files), n0 ≤ # buf, psynced → asynced, (err1 = ESUCCESS ⊃ (files0[of[fd].ino].content.stream to files0[of[fd].ino].size).buf = splice(buf, 0, (files[of[fd].ino].content.stream to files[of[fd].ino].size).buf, of[fd].pos, n1) ∧ fd ∈ of ∧ of0 = of[fd, of[fd].pos:= (of[fd].pos + n1)] ∧ n1 ≤ n0 ∧ of[fd].ino ∈ files ∧ of[fd].ino ∈ files0 ∧ files0[of[fd].ino].meta = files[of[fd].ino].meta ∧ files0 -- of[fd].ino = files -- of[fd].ino ∧ (of[fd].mode = MODE_W ∨ of[fd].mode = MODE_RW) ;files0 ~ files ∧ of = of0 ∧ (err1 = EBADFD ∧ (fd ∈ of0 → of0[fd].mode ≠ MODE_W ∧ of0[fd].mode ≠ MODE_RW) ∨ ⌊err1⌋ ) ) ⊦ ⟨if n0 ≤ # buf then {choose err with pre-write(fd, buf, n0, err, user, root, fs, ofh) in err0 := err; if err0 = ESUCCESS then let fh = ofh[fd] in let f = fs[fh.fid] in choose n with n ≤ n0 in {n0 := n; f.content := splice(buf, 0, f.content, fh.pos, n0); fs[fh.fid] := f; ofh[fd].pos := fh.pos + n0} else n0 := ?; psynced := ?} else abort⟩ (ofh = abs-of(of0) ∧ fs = abs-files(files0) ∧ (psynced → asynced0) ∧ n1 = n0 ∧ err1 = err0)
Used simplifier rules: posix_write#(FD, BUF, USER, ROOT; N, ERR, FS, OFH; PSYNCED) {if N ≤ # BUF then {choose E with pre-write(FD, BUF, N, E, USER, ROOT, FS, OFH) in ERR := E; if ERR = ESUCCESS then let FH = OFH[FD] in let FDATA = FS[FH.fid] in choose N0 with N0 ≤ N in {N := N0; FDATA.content := splice(BUF, 0, FDATA.content, FH.pos, N); FS[FH.fid] := FDATA; OFH[FD].pos := FH.pos + N} else N := ?; PSYNCED := ?} else abort };