I have a snippet of agda code of the following form:
Terminates : → S → Set
Terminates c s = Σ[ n ∈ ℕ ] ( Is-just (proj₂ (smallStepEvalwithFuel n ( c , just s ))))
evalAssiProg : ∀ {i e} → S → (p : i := e) → Maybe S
evalAssiProg s (id ꞉= exp) with evalExp exp s
... | nothing = nothing -- Comp failed. i.e. ÷ by 0 error
... | just v = just (updateState id v s) -- Comp success
example : ∀ i v exp s → ( a : i := exp ) → evalExp exp s ≡ just v → Terminates ( ꞉ a ) s
example i v e s (.i ꞉= .e) p with evalExp e s
... | just x = 1 , {!!} --<----------------------! Problem here
I'm hoping that the details don't matter too much, basically evalExp e s has the form evalExp : Exp → S → Maybe Val i.e. it takes an expression, a state, and spits out the value unless a divide by zero error occurs for example. So it is a tedious but simple function.
All I'm interested in is: how can I pattern match on evalExp e s in example, and have agda correctly work out that the only possible case is just x but still if I look in the goal on the right hand side of the product I have that the goal is still waiting on the result of evalExp e s:
Goal: Any (λ _ → ⊤)
(Mini-C.Evaluation.evalAssiProg dRep sRep s (i Mini-C.Lang._:=_.꞉= e)
| evalExp e s)
————————————————————————————————————————————————————————————
i : Id
s : S
e : Exp
sRep : S-Representation dRep
p : just x ≡ just v
v : Val
x : Val
dRep : D-Representation