Skip to content

Commit 75ad622

Browse files
committed
Start fixing assume false's
1 parent cb1ff16 commit 75ad622

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ src/nonlin/%.dfy.ok: DAFNY_ARGS = /arith:1
4444
# up unused imports emitted by Dafny.
4545
dafnygen/dafnygen.go: src/compile.dfy $(DFY_FILES)
4646
@echo "DAFNY COMPILE $<"
47-
$(Q)$(DAFNY) /countVerificationErrors:0 /spillTargetCode:2 /out dafnygen $<
47+
$(Q)$(DAFNY) /noVerify /spillTargetCode:2 /out dafnygen $<
4848
$(Q)rm -rf dafnygen
4949
$(Q)cd dafnygen-go/src && ../../etc/dafnygen-imports.py ../../dafnygen
5050
$(Q)rm -r dafnygen-go

src/fs/indirect/pos.dfy

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,13 @@ module IndirectPos
301301
assert 8 <= from_flat(n0).k < 8+3;
302302
if n < 512 {
303303
assert from_flat(n0).k == 8;
304-
assert from_flat(n0).flat() == n0 by { assume false; }
304+
assert from_flat(n0).off.ilevel == 1;
305+
assert from_flat(n0).off.j == n % 512;
306+
// this lemma is actually required to prove this equality (it's hard
307+
// to get Dafny to compute this recursive function)
308+
config_totals_after_8(8);
309+
assert config.total_to(8) == 8;
310+
assert from_flat(n0).flat() == n0;
305311
return;
306312
}
307313
if n < 2*512 {

src/fs/indirect_fs.dfy

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,10 @@ module IndFs
690690
ok, bn := allocateIndirectMetadata(txn, pos, ibn, pblock);
691691
c.ok := false;
692692
c.bs := NewBytes(0);
693-
assert ValidIno(pos.ino, i) by { assume false; }
693+
assert ValidIno(pos.ino, i) by {
694+
assume false; // otherwise times out
695+
assert i.Valid() && fs.is_cur_inode(pos.ino, i.val());
696+
}
694697
if !ok {
695698
IndBlocks.to_blknos_zero();
696699
reveal ValidIndirect();

src/fs/inode_fs.dfy

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,15 +478,24 @@ module InodeFs {
478478
}
479479
assert Valid() by {
480480
reveal Valid_jrnl_super_block();
481-
reveal Valid_jrnl_to_data_block();
482481
reveal Valid_jrnl_to_block_used();
483482
assert && Valid_basics(jrnl)
484483
&& Valid_domains()
485484
&& Valid_jrnl_super_block(ballocActualMax)
486485
&& Valid_jrnl_to_block_used(block_used)
487486
&& Valid_jrnl_to_inodes(inodes)
488487
&& Valid_balloc();
489-
assert && Valid_jrnl_to_data_block(data_block) by { assume false; }
488+
assert Valid_jrnl_to_data_block(data_block) by {
489+
reveal Valid_jrnl_to_data_block();
490+
forall bn | blkno_ok(bn) && bn != 0
491+
ensures (
492+
datablk_inbounds(jrnl, bn);
493+
jrnl.data[DataBlk(bn)] == ObjData(data_block[bn])) {
494+
datablk_inbounds(jrnl, bn);
495+
assert jrnl.data[DataBlk(bn)] == old(jrnl.data[DataBlk(bn)]);
496+
}
497+
assert Valid_jrnl_to_data_block(data_block);
498+
}
490499
}
491500
}
492501

src/fs/typed_fs.dfy

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -549,15 +549,16 @@ module TypedFs {
549549
eof := true;
550550
return;
551551
}
552-
assume false;
553552
var readLen: uint64 := len;
554553
if off + len >= i.sz {
555554
readLen := i.sz - off;
556555
eof := true;
557556
} else {
558557
eof := false;
559558
}
559+
reveal_valids();
560560
bs, ok := fs.readWithInode(txn, ino, i, off, readLen);
561+
reveal_valids();
561562
reveal ValidFields();
562563
}
563564

0 commit comments

Comments
 (0)