Zulip Chat Archive

Stream: new members

Topic: Proof on array indices


Jesse Wright (Jan 28 2024 at 14:46):

I'm trying to work out how to replace the sorry in the following definition with a proof.

The main hurdle I am hitting is how to state and use the hypothesis h: t.size = 1 within the if condition.

def get(t : Array String) : String := if t.size = 1 then t.get 0, sorry else ""

Henrik Böving (Jan 28 2024 at 14:47):

if h:t.size = 1 then ... will get you the hypothesis in scope


Last updated: May 02 2025 at 03:31 UTC