src/HOL/Quotient_Examples/Int_Pow.thy
changeset 57512 cc97b347b301
parent 53682 1b55aeda0e46
child 62378 85ed00c1fe7c
equal deleted inserted replaced
57511:de51a86fc903 57512:cc97b347b301
    51   assumes [simp, intro]: "a \<in> Units G" 
    51   assumes [simp, intro]: "a \<in> Units G" 
    52   shows "a (^) (m::nat) \<otimes> inv (a (^) (n::nat)) = inv (a (^) n) \<otimes> a (^) m"
    52   shows "a (^) (m::nat) \<otimes> inv (a (^) (n::nat)) = inv (a (^) n) \<otimes> a (^) m"
    53 proof (cases "m\<ge>n")
    53 proof (cases "m\<ge>n")
    54   have [simp]: "a \<in> carrier G" using `a \<in> _` by (rule Units_closed)
    54   have [simp]: "a \<in> carrier G" using `a \<in> _` by (rule Units_closed)
    55   case True
    55   case True
    56     then obtain k where *:"m = k + n" and **:"m = n + k" by (metis Nat.le_iff_add nat_add_commute)
    56     then obtain k where *:"m = k + n" and **:"m = n + k" by (metis Nat.le_iff_add add.commute)
    57     have "a (^) (m::nat) \<otimes> inv (a (^) (n::nat)) = a (^) k"
    57     have "a (^) (m::nat) \<otimes> inv (a (^) (n::nat)) = a (^) k"
    58       using * by (auto simp add: nat_pow_mult[symmetric] m_assoc)
    58       using * by (auto simp add: nat_pow_mult[symmetric] m_assoc)
    59     also have "\<dots> = inv (a (^) n) \<otimes> a (^) m"
    59     also have "\<dots> = inv (a (^) n) \<otimes> a (^) m"
    60       using ** by (auto simp add: nat_pow_mult[symmetric] m_assoc[symmetric])
    60       using ** by (auto simp add: nat_pow_mult[symmetric] m_assoc[symmetric])
    61     finally show ?thesis .
    61     finally show ?thesis .
    62 next
    62 next
    63   have [simp]: "a \<in> carrier G" using `a \<in> _` by (rule Units_closed)
    63   have [simp]: "a \<in> carrier G" using `a \<in> _` by (rule Units_closed)
    64   case False
    64   case False
    65     then obtain k where *:"n = k + m" and **:"n = m + k" 
    65     then obtain k where *:"n = k + m" and **:"n = m + k" 
    66       by (metis Nat.le_iff_add nat_add_commute nat_le_linear)
    66       by (metis Nat.le_iff_add add.commute nat_le_linear)
    67     have "a (^) (m::nat) \<otimes> inv (a (^) (n::nat)) = inv(a (^) k)"
    67     have "a (^) (m::nat) \<otimes> inv (a (^) (n::nat)) = inv(a (^) k)"
    68       using * by (auto simp add: nat_pow_mult[symmetric] m_assoc[symmetric] inv_mult_units)
    68       using * by (auto simp add: nat_pow_mult[symmetric] m_assoc[symmetric] inv_mult_units)
    69     also have "\<dots> = inv (a (^) n) \<otimes> a (^) m"
    69     also have "\<dots> = inv (a (^) n) \<otimes> a (^) m"
    70       using ** by (auto simp add: nat_pow_mult[symmetric] m_assoc inv_mult_units)
    70       using ** by (auto simp add: nat_pow_mult[symmetric] m_assoc inv_mult_units)
    71     finally show ?thesis .
    71     finally show ?thesis .
    84   assumes a_in_G [simp, intro]: "a \<in> Units G"
    84   assumes a_in_G [simp, intro]: "a \<in> Units G"
    85   shows "a (^) b \<otimes> inv (a (^) c) = a (^) d \<otimes> inv (a (^) e)"
    85   shows "a (^) b \<otimes> inv (a (^) c) = a (^) d \<otimes> inv (a (^) e)"
    86 proof(cases "b\<ge>c")
    86 proof(cases "b\<ge>c")
    87   have [simp]: "a \<in> carrier G" using `a \<in> _` by (rule Units_closed)
    87   have [simp]: "a \<in> carrier G" using `a \<in> _` by (rule Units_closed)
    88   case True
    88   case True
    89     then obtain n where "b = n + c" by (metis Nat.le_iff_add nat_add_commute)
    89     then obtain n where "b = n + c" by (metis Nat.le_iff_add add.commute)
    90     then have "d = n + e" using eq by arith
    90     then have "d = n + e" using eq by arith
    91     from `b = _` have "a (^) b \<otimes> inv (a (^) c) = a (^) n" 
    91     from `b = _` have "a (^) b \<otimes> inv (a (^) c) = a (^) n" 
    92       by (auto simp add: nat_pow_mult[symmetric] m_assoc)
    92       by (auto simp add: nat_pow_mult[symmetric] m_assoc)
    93     also from `d = _`  have "\<dots> = a (^) d \<otimes> inv (a (^) e)"   
    93     also from `d = _`  have "\<dots> = a (^) d \<otimes> inv (a (^) e)"   
    94       by (auto simp add: nat_pow_mult[symmetric] m_assoc)
    94       by (auto simp add: nat_pow_mult[symmetric] m_assoc)
    95     finally show ?thesis .
    95     finally show ?thesis .
    96 next
    96 next
    97   have [simp]: "a \<in> carrier G" using `a \<in> _` by (rule Units_closed)
    97   have [simp]: "a \<in> carrier G" using `a \<in> _` by (rule Units_closed)
    98   case False
    98   case False
    99     then obtain n where "c = n + b" by (metis Nat.le_iff_add nat_add_commute nat_le_linear)
    99     then obtain n where "c = n + b" by (metis Nat.le_iff_add add.commute nat_le_linear)
   100     then have "e = n + d" using eq by arith
   100     then have "e = n + d" using eq by arith
   101     from `c = _` have "a (^) b \<otimes> inv (a (^) c) = inv (a (^) n)" 
   101     from `c = _` have "a (^) b \<otimes> inv (a (^) c) = inv (a (^) n)" 
   102       by (auto simp add: nat_pow_mult[symmetric] m_assoc[symmetric] inv_mult_units)
   102       by (auto simp add: nat_pow_mult[symmetric] m_assoc[symmetric] inv_mult_units)
   103     also from `e = _` have "\<dots> = a (^) d \<otimes> inv (a (^) e)"   
   103     also from `e = _` have "\<dots> = a (^) d \<otimes> inv (a (^) e)"   
   104       by (auto simp add: nat_pow_mult[symmetric] m_assoc[symmetric] inv_mult_units)
   104       by (auto simp add: nat_pow_mult[symmetric] m_assoc[symmetric] inv_mult_units)