1

In Isabelle HOL, I have a predicate on two numbers like this:

definition f :: "nat ⇒ nat ⇒ bool"
  where 
    ...

I can prove that this predicate is morally a function:

lemma f_function:
  fixes x :: nat
  shows "∃! y . f x y""
  ...

Intuitively, this should be enough for me to construct a function f' :: nat ⇒ nat that is provably equivalent to f', i.e.:

lemma f'_correct:
  "f x y = (f' x = y)" 

But how do I do that?

definition f' :: "nat ⇒ nat"
  where
    "f' x ≡ ?"

What do I put in for the question mark?

Søren Debois
  • 5,598
  • 26
  • 48

1 Answers1

3

The typical approach is to use the definite description operator THE:

definition f' :: "nat ⇒ nat" where "f' x = (THE y. f x y)"

If you have already proven that this y is unique, you can then use e.g. the theorem theI' to show that f x (f' x) holds and theI_unique to show that if f x y holds, then y = f' x.

For more information about THE, SOME, etc. see the following:

Manuel Eberl
  • 7,858
  • 15
  • 24