Theory Lifting_Code_Dt_Test
theory Lifting_Code_Dt_Test
imports Main
begin
typedef bool2 = "{x. x}" by auto
setup_lifting type_definition_bool2
lift_definition(code_dt) f1 :: "bool2 option" is "Some True" by simp
lift_definition(code_dt) f2 :: "bool2 list" is "[True]" by simp
lift_definition(code_dt) f3 :: "bool2 × int" is "(True, 42)" by simp
lift_definition(code_dt) f4 :: "int + bool2" is "Inr True" by simp
lift_definition(code_dt) f5 :: "'a ⇒ (bool2 × 'a) option" is "λx. Some (True, x)" by simp
typedef 'a T = "{ x::'a. ∀(y::'a) z::'a. ∃(w::'a). (z = z) ∧ eq_onp top y y
∨ rel_prod (eq_onp top) (eq_onp top) (x, y) (x, y) ⟶ pred_prod top top (w, w) }"
by auto
setup_lifting type_definition_T
lift_definition(code_dt) f6 :: "bool T option" is "Some True" by simp
lift_definition(code_dt) f7 :: "(bool T × int) option" is "Some (True, 42)" by simp
lift_definition(code_dt) f8 :: "bool T ⇒ int ⇒ (bool T × int) option"
is "λx y. if x then Some (x, y) else None" by simp
lift_definition(code_dt) f9 :: "nat ⇒ ((bool T × int) option) list × nat"
is "λx. ([Some (True, 42)], x)" by simp