Theory OpInl
theory OpInl
imports Op
begin
section βΉn-ary operationsβΊ
locale nary_operations_inl =
nary_operations ππ ππ―π¦π±πΆ
for
ππ :: "'op β 'a list β 'a" and ππ―π¦π±πΆ +
fixes
βπ«π©ππ :: "'opinl β 'a list β 'a" and
βπ«π© :: "'op β 'a list β 'opinl option" and
βπ°βπ«π© :: "'opinl β 'a list β bool" and
ππ’βπ«π© :: "'opinl β 'op"
assumes
βπ«π©_invertible: "βπ«π© op xs = Some opinl βΉ ππ’βπ«π© opinl = op" and
βπ«π©ππ_correct: "length xs = ππ―π¦π±πΆ (ππ’βπ«π© opinl) βΉ βπ«π©ππ opinl xs = ππ (ππ’βπ«π© opinl) xs" and
βπ«π©_βπ°βπ«π©: "βπ«π© op xs = Some opinl βΉ βπ°βπ«π© opinl xs"
begin
lemma βπ«π©_inj_on: "inj_on βπ«π© { op | op args. βπ«π© op args β None }"
apply (simp add: inj_on_def)
proof (intro allI impI, elim exE)
fix opβ©1 opβ©2 argsβ©1 argsβ©2 opinlβ©1 opinlβ©2
assume assms: "βπ«π© opβ©1 = βπ«π© opβ©2" "βπ«π© opβ©1 argsβ©1 = Some opinlβ©1" "βπ«π© opβ©2 argsβ©2 = Some opinlβ©2"
hence "ππ’βπ«π© opinlβ©1 = opβ©1" "ππ’βπ«π© opinlβ©1 = opβ©2"
by (auto intro: βπ«π©_invertible)
thus "opβ©1 = opβ©2"
by simp
qed
abbreviation βπ«π©_dom where
"βπ«π©_dom β‘ {op | op args. βπ«π© op args β None }"
lemma "bij_betw βπ«π© βπ«π©_dom { βπ«π© op | op. op β βπ«π©_dom}"
using bij_betw_def
unfolding image_def
using βπ«π©_inj_on
by (auto simp add: bij_betw_def)
end
end