fact: Definition Zegcd a b := match a, b with | Z0, Z0 => (0,0,0) | Zpos _, Z0 => (1,0,a) | Zneg _, Z0 => (-1,0,-a) | Z0, Zpos _ => (0,1,b) | Z0, Zneg _ => (0,-1,-b) | Zpos a, Zneg b => match egcd a b with (u,v,w) => (u,-v, Zpos w) end | Zneg a, Zpos b => match egcd a b with (u,v,w) => (-u,v, Zpos w) end | Zpos a, Zpos b => match egcd a b with (u,v,w) => (u,v, Zpos w) end | Zneg a, Zneg b => match egcd a b with (u,v,w) => (-u,-v, Zpos w) end end.
imports: ZArith Lia ZCmisc Zwf ZArith Znumtheory