There is a set of pairs (set_pairs) and I want to create a set (set_fsts) of first elements of those pairs. I am writing it in the following way

definition "set_fsts = {f . p ∈ set_piars ∧ fst p = f}" but Isabelle shows me this err msg: Extra variable on rhs "p"

Could you please help me with this?

2

There are 2 best solutions below

1
user17750837 On

You need to introduce p by existential quantification, i.e. EX p. P : set_pairs ...

Shorter way would be to define set_fsts as fst ` set_pairs

2
Slawomir K. On

You can try

set_fsts = {fst p . p ∈ set_piars}

This would work in Isabelle/ZF, I am not sure about Isabelle/HOL.