lean4-htt/tests/lean/run/10934.lean
Henrik Böving a51822ead2
perf: inline Decidable instances (#11008)
This PR inlines several Decidable instances for performance reasons.

Unlike the previous #10934 it does not attempt to also simplify the
Decidable instance system as
that has proven to have non trivial performance impact.

Co-authored-by: Rob23oba <152706811+Rob23oba@users.noreply.github.com>
2025-10-29 10:59:54 +00:00

74 lines
1.9 KiB
Text

set_option trace.compiler.ir.result true
/--
trace: [Compiler.IR] [result]
def _example (x_1 : u8) (x_2 : u8) : u8 :=
case x_1 : u8 of
Bool.false →
case x_2 : u8 of
Bool.false →
let x_3 : u8 := 1;
ret x_3
Bool.true →
ret x_1
Bool.true →
ret x_2
def _example._boxed (x_1 : tagged) (x_2 : tagged) : tagged :=
let x_3 : u8 := unbox x_1;
let x_4 : u8 := unbox x_2;
let x_5 : u8 := _example x_3 x_4;
let x_6 : tobj := box x_5;
ret x_6
-/
#guard_msgs in
example (a b : Bool) : Bool := decide (a ↔ b)
/--
trace: [Compiler.IR] [result]
def _example (x_1 : u8) (x_2 : u8) : u8 :=
case x_1 : u8 of
Bool.false →
let x_3 : u8 := 1;
ret x_3
Bool.true →
ret x_2
def _example._boxed (x_1 : tagged) (x_2 : tagged) : tagged :=
let x_3 : u8 := unbox x_1;
let x_4 : u8 := unbox x_2;
let x_5 : u8 := _example x_3 x_4;
let x_6 : tobj := box x_5;
ret x_6
-/
#guard_msgs in
example (a b : Bool) : Bool := decide (a → b)
/--
trace: [Compiler.IR] [result]
def _example (x_1 : u8) (x_2 : u8) : u8 :=
case x_1 : u8 of
Bool.false →
ret x_1
Bool.true →
ret x_2
def _example._boxed (x_1 : tagged) (x_2 : tagged) : tagged :=
let x_3 : u8 := unbox x_1;
let x_4 : u8 := unbox x_2;
let x_5 : u8 := _example x_3 x_4;
let x_6 : tobj := box x_5;
ret x_6
-/
#guard_msgs in
example (a b : Bool) : Bool := decide (∃ _ : a, b)
/--
trace: [Compiler.IR] [result]
def _example (x_1 : u8) : u8 :=
ret x_1
def _example._boxed (x_1 : tagged) : tagged :=
let x_2 : u8 := unbox x_1;
let x_3 : u8 := _example x_2;
let x_4 : tobj := box x_3;
ret x_4
-/
#guard_msgs in
example (a : Bool) : Bool := decide (if _h : a then True else False)