Closed EmilyOng closed 9 months ago
This is the same problem as the one you encountered for quicksort. In the inductive case, is_cons([])=true
is false, so we have ens false; ...
with some other stages after. The proof then fails because entailment between flows is only defined when they have the same length.
The solution is to normalize ens false; ...
to ens false
, because ens false
models an unreachable/nonterminating program state, so whatever comes after shouldn't matter. We can then (vacuously) prove false => res=[]
. I just pushed this fix.
Ooh, I see, thanks for responding!
Proof sketch:
[unfold
iter
][then, proceed on base case and inductive case]
Base case:
ex v18; req emp; iter([], v18); req emp; Norm(res=v18) <: req emp; Norm(res=[])
ex v18; req emp; Norm(is_nil([])=true/\res=[])
is_nil([])=true/\res=[] => res=[]
Inductive case:
ex v18 v33; req emp; ens tail([])=v33/\is_cons([])=true; iter(v33, v18); req emp; Norm(res=v18) <: req emp; Norm(res=[])
(direct substitution with the unfolding)unfolding_bound
will not help