theory Question imports Main begin datatype (discs_sels) 'a "term" = V 'a | U | T "'a term * 'a term" | C "'a term * 'a term" | L "'a term" | L' "'a term" | R "'a term" | R' "'a term" | A "'a term * 'a term * 'a term" | A' "'a term * 'a term * 'a term" primrec I :: "'a term \ bool" where "I (V x) = True" | "I U = True" | "I (T tu) = (\tu. fst tu \ snd tu) (map_prod I I tu)" | "I (C tu) = False" | "I (L t) = False" | "I (L' t) = False" | "I (R t) = False" | "I (R' t) = False" | "I (A tuv) = False" | "I (A' tuv) = False" fun F :: "'a term \ 'a term" where "F (T (T (a, b), c)) = A (a, b, c)" | "F (T (U, b)) = L b" | "F (T (a, U)) = R a" | "F (T (a, b)) = (if I (F a) then T (a, F b) else T (F a, b))" | "F a = a" lemma assumes "\is_T a" and "a \ U" and "b \ U" shows "F (T (a, b)) = (if I (F a) then T (a, F b) else T (F a, b))" sorry end