Binary encoding of rational numbers #
Turing.MultiTapeTM.encRat encodes a rational number q : ℚ as its framed pair
(q.num, q.den) : ℤ × ℕ using Turing.MultiTapeTM.encIntBin and Turing.MultiTapeTM.encNat.
Main definitions #
Turing.MultiTapeTM.encRatData: framed pair encoding of(ℤ × ℕ)used for rationals.Turing.MultiTapeTM.encRat: binary encoding ofℚvia(q.num, q.den).
Main results #
Turing.MultiTapeTM.encRat_apply: unfolding ofencRat q.Turing.MultiTapeTM.length_encRat,Turing.MultiTapeTM.length_encRat_le: exact encoded bit length ofencRat qand upper bound from numerator/denominator sizes.Turing.MultiTapeTM.length_encRat_num_le:(encIntBin q.num).length ≤ (encRat q).length.Turing.MultiTapeTM.length_encRat_den_le:(encNat q.den).length ≤ (encRat q).length.Turing.MultiTapeTM.natAbs_num_lt_two_pow_length_encRat,Turing.MultiTapeTM.den_lt_two_pow_length_encRat: numerator/denominator magnitude bounds.Turing.MultiTapeTM.length_encRat_divInt_le,Turing.MultiTapeTM.length_encRat_neg,Turing.MultiTapeTM.length_encRat_inv_le,Turing.MultiTapeTM.length_encRat_mul_le,Turing.MultiTapeTM.length_encRat_add_le,Turing.MultiTapeTM.length_encRat_sub_le,Turing.MultiTapeTM.length_encRat_div_le: encoded length bounds for rational arithmetic.
Encoded length of Rat.divInt a b in terms of the binary lengths of a and b.