@@ -92,10 +92,10 @@ theorem isInt_lcm : {x y nx ny : ℤ} → {z : ℕ} →
9292and an equality proof. Panics if `ex` or `ey` aren't natural number literals. -/
9393def proveNatGCD (ex ey : Q(ℕ)) : (ed : Q(ℕ)) × Q(Nat.gcd $ex $ey = $ed) :=
9494 match ex.natLit!, ey.natLit! with
95- | 0 , _ => show (ed : Q(ℕ)) × Q(Nat.gcd 0 $ey = $ed) from ⟨ey, q(Nat.gcd_zero_left $ey)⟩
96- | _, 0 => show (ed : Q(ℕ)) × Q(Nat.gcd $ex 0 = $ed) from ⟨ex, q(Nat.gcd_zero_right $ex)⟩
97- | 1 , _ => show (ed : Q(ℕ)) × Q(Nat.gcd 1 $ey = $ed) from ⟨mkRawNatLit 1 , q(Nat.gcd_one_left $ey)⟩
98- | _, 1 => show (ed : Q(ℕ)) × Q(Nat.gcd $ex 1 = $ed) from ⟨mkRawNatLit 1 , q(Nat.gcd_one_right $ex)⟩
95+ | 0 , _ => have : $ex =Q nat_lit 0 := ⟨⟩; ⟨ey, q(Nat.gcd_zero_left $ey)⟩
96+ | _, 0 => have : $ey =Q nat_lit 0 := ⟨⟩; ⟨ex, q(Nat.gcd_zero_right $ex)⟩
97+ | 1 , _ => have : $ex =Q nat_lit 1 := ⟨⟩; ⟨q( nat_lit 1 ) , q(Nat.gcd_one_left $ey)⟩
98+ | _, 1 => have : $ey =Q nat_lit 1 := ⟨⟩; ⟨q( nat_lit 1 ) , q(Nat.gcd_one_right $ex)⟩
9999 | x, y =>
100100 let (d, a, b) := Nat.xgcdAux x 1 0 y 0 1
101101 if d = x then
@@ -110,10 +110,10 @@ def proveNatGCD (ex ey : Q(ℕ)) : (ed : Q(ℕ)) × Q(Nat.gcd $ex $ey = $ed) :=
110110 if d = 1 then
111111 if a ≥ 0 then
112112 have pt : Q($ex * $ea' = $ey * $eb' + 1 ) := (q(Eq.refl ($ex * $ea')) : Expr)
113- ⟨mkRawNatLit 1 , q(nat_gcd_helper_2' $ex $ey $ea' $eb' $pt)⟩
113+ ⟨q( nat_lit 1 ) , q(nat_gcd_helper_2' $ex $ey $ea' $eb' $pt)⟩
114114 else
115115 have pt : Q($ey * $eb' = $ex * $ea' + 1 ) := (q(Eq.refl ($ey * $eb')) : Expr)
116- ⟨mkRawNatLit 1 , q(nat_gcd_helper_1' $ex $ey $ea' $eb' $pt)⟩
116+ ⟨q( nat_lit 1 ) , q(nat_gcd_helper_1' $ex $ey $ea' $eb' $pt)⟩
117117 else
118118 have ed : Q(ℕ) := mkRawNatLit d
119119 have pu : Q(Nat.mod $ex $ed = 0 ) := (q(Eq.refl (nat_lit 0 )) : Expr)
@@ -142,9 +142,9 @@ and an equality proof. Panics if `ex` or `ey` aren't natural number literals. -/
142142def proveNatLCM (ex ey : Q(ℕ)) : (ed : Q(ℕ)) × Q(Nat.lcm $ex $ey = $ed) :=
143143 match ex.natLit!, ey.natLit! with
144144 | 0 , _ =>
145- show (ed : Q(ℕ)) × Q(Nat.lcm 0 $ey = $ed) from ⟨mkRawNatLit 0 , q(Nat.lcm_zero_left $ey)⟩
145+ show (ed : Q(ℕ)) × Q(Nat.lcm 0 $ey = $ed) from ⟨q( nat_lit 0 ) , q(Nat.lcm_zero_left $ey)⟩
146146 | _, 0 =>
147- show (ed : Q(ℕ)) × Q(Nat.lcm $ex 0 = $ed) from ⟨mkRawNatLit 0 , q(Nat.lcm_zero_right $ex)⟩
147+ show (ed : Q(ℕ)) × Q(Nat.lcm $ex 0 = $ed) from ⟨q( nat_lit 0 ) , q(Nat.lcm_zero_right $ex)⟩
148148 | 1 , _ => show (ed : Q(ℕ)) × Q(Nat.lcm 1 $ey = $ed) from ⟨ey, q(Nat.lcm_one_left $ey)⟩
149149 | _, 1 => show (ed : Q(ℕ)) × Q(Nat.lcm $ex 1 = $ed) from ⟨ex, q(Nat.lcm_one_right $ex)⟩
150150 | x, y =>
0 commit comments