| abs-of(of)[fd] = mkfh(fid, mode, m), buf = buf0, n = n0, 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 ≤ # buf0, ¬ fd ∈ of, psynced → asynced ⊦ (¬ fd ∈ ofh ∨ mode ≠ MODE_R ∧ mode ≠ MODE_RW) ∧ ⟨err0 := EBADFD; if err0 = ESUCCESS then let fh = ofh[fd] in let f = abs-files(files)[fh.fid] in choose n with n ≤ n0 ∧ fh.pos + n ≤ # f.content in {n0 := n; buf := copy(f.content, fh.pos, buf, 0, n0); ofh[fd].pos := fh.pos + n0} ifnone n0 := 0 else n0 := ?⟩ (ofh = abs-of(of) ∧ (psynced → asynced) ∧ buf0 = buf ∧ n = n0 ∧ EBADFD = err0) |
abs-of(of)[fd] = mkfh(fid, mode, m), buf = buf0, n = n0, 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 ≤ # buf0, psynced → asynced ⊦ ⟨err0 := EBADFD; if err0 = ESUCCESS then let fh = ofh[fd] in let f = abs-files(files)[fh.fid] in choose n with n ≤ n0 ∧ fh.pos + n ≤ # f.content in {n0 := n; buf := copy(f.content, fh.pos, buf, 0, n0); ofh[fd].pos := fh.pos + n0} ifnone n0 := 0 else n0 := ?⟩ (ofh = abs-of(of) ∧ (psynced → asynced) ∧ buf0 = buf ∧ n = n0 ∧ EBADFD = err0), fd ∈ of
Used simplifier rules: ⊦ fd ∈ abs-of(of) ↔ fd ∈ of; (s)%fd ∈ of ⊦ abs-of(of)[fd] = mkfh(⌜of[fd].ino⌝ , of[fd].mode, of[fd].pos); (s)% ⊦ ¬ fd ∈ of → of[fd] = (∅)[fd]; (s)%⊦ mkfh(fid, mode, m) = mkfh(fid0, mode0, m0) ↔ fid = fid0 ∧ mode = mode0 ∧ m = m0; (ws)