theory AxOverrAndUpd
imports Main
begin
text
{* we define a locale containing our symbols, the constant empty set
and the first three axioms *}
locale ax123 =
(* overriding *) fixes over :: "'a \ 'a \ 'a" (infixl "\" 101)
(* minus *) fixes min :: "'a \ 'a \ 'a" (infixl "\" 102)
(* empty *) fixes e :: "'a"
(* Axiom 1 *) assumes idemp: "f \ f = f"
(* Axiom 2 *) assumes empty: "f \ f = e"
(* Axiom 3, called weak commutativity in the paper *)
assumes swap: "f \ g \ g = g \ f"
(* restriction *) fixes dorestri::"'a \ 'a\ 'a" (infixl "\" 103)
(* @ *) assumes restri: "f \ g = f \ (f \ g)"
text {* Then we define three different locales containing a different set of axioms.
We use it to find proofs of some laws without using all the axioms.*}
locale ax1234 = ax123 + (* context with Axioms 1 to 4 *)
(* Axiom 4, called double minus in the paper *)
assumes dbmin: "f \ (g \ h) = f \ g \ f \ (f \ h)"
locale ax1235 = ax123 +
(* Axiom 5 *) assumes distr: "(f \ g) \ h = (f \ h) \ (g \ h)"
locale ax12345 = ax1235 +
(* Axiom 4 *) assumes dbmin: "f \ (g \ h) = f \ g \ f \ (f \ h)"
lemma (in ax1235) law8: (* Law A/8, empty domain *)
shows "e \ f = f"
by (metis empty idemp swap)
lemma (in ax1235) law10: (* Law B/10, empty domain *)
shows "e \ f = e"
by (metis distr empty law8 swap)
lemma (in ax1235) law7: (* Law C/7, empty domain *)
shows "f \ e = f"
by (metis law10 law8 swap)
lemma (in ax1235) law9: (* Law D/9, empty domain *)
shows "f \ e = f"
by (metis law7 law8 swap)
lemma (in ax1235) law13: (* Law E/13, idempotence *)
shows "f \ f = f"
by (metis restri empty law9)
lemma (in ax1235) lawF: (* Law F/ *)
shows "(x \ y) \ x = y \ x"
by (metis distr empty law8)
lemma (in ax1235) lawG: (* Law G/ *)
shows "(x \ y) \ y = x \ y"
by (metis distr empty law7)
lemma (in ax1235) law18: (* Law H/18, distributivity *)
shows "(x \ y \ z) \ x = y \ x \ z \ x"
by (metis distr lawF)
lemma (in ax1235) lawI: (* Law I/ *)
shows "y \ (x \ y) = y \ x"
by (metis lawG swap)
lemma (in ax1235) lawJ: (* Law J/ *)
shows "x \ (x \ y) = x \ y"
by (metis lawF swap)
lemma (in ax1235) law31: (* Law K/31, compatible *)
shows "x \ y \ x = x \ y"
by (metis lawI lawJ swap)
text {* From here all the axioms are needed. We now only proof the remaining laws
from the paper. *}
lemma (in ax12345) law30: (* Law L/30, agree *)
shows "x \ y \ x = x"
by (metis dbmin empty law31 law9)
lemma (in ax12345) law24: (* Law M/24, partitioning *)
shows "x \ y \ x \ y = x"
by (metis law30 restri swap)
lemma (in ax12345) law27: (* Law N/27, double minus *)
shows "x \ (y \ x) = x"
by (metis dbmin empty law30 law9)
lemma (in ax12345) lawO: (* Law O/ *)
shows "x \ y \ y = x \ y"
by (metis law27)
lemma (in ax12345) lawP: (* Law P/ *)
shows "x \ y \ z = x \ y \ (z \ y)"
by (metis dbmin empty law7 lawO)
lemma (in ax12345) lawQ: (* Law Q/ *)
shows "x \ y \ x = e"
by (metis empty law30 lawG)
lemma (in ax12345) lawR: (* Law R/ *)
shows "x \ y \ (z \ x) = x \ y"
by (metis dbmin law30 law9 lawQ)
lemma (in ax12345) law19: (* Law S/19, weak commutativity *)
shows "x \ y \ z = x \ z \ y"
by (metis distr law27 law31 lawF lawP lawR)
lemma (in ax12345) lawT: (* Law T/ *)
shows "x \ (y \ (z \ x)) = x \ y"
by (metis law27 lawP)
lemma (in ax12345) lawU: (* Law U/ *)
shows "x \ (y \ (x \ z)) = x"
by (metis dbmin empty law30 law9 lawG lawJ)
lemma (in ax12345) law26: (* Law V/26, combine minus *)
shows "(x \ y) \ z = x \ (y \ z)"
by (metis law19 law27 lawG lawP lawU swap)
lemma (in ax12345) law28: (* Law W/28, overlapping *)
shows "x \ y \ x = x"
by (metis empty law19 law31 law7 restri)
lemma (in ax12345) lawX: (* Law X/ *)
shows "x \ y \ z = x \ y \ (x \ z)"
by (metis law19 law26 law31)
lemma (in ax12345) law29: (* Law Y/29, agree *)
shows "x \ x \ y = x"
by (metis law31 law7 lawQ)
lemma (in ax12345) law20: (* Law Z/20, weak commutativity *)
shows "x \ (y \ z) = x \ (z \ y)"
by (metis law19 law26)
lemma (in ax12345) lawa: (* Law a/ *)
shows "x \ x \ y = x \ y"
by (metis law27 law30 law31 lawG restri)
lemma (in ax12345) lawb: (* Law b/ *)
shows "x \ y \ z = (x \ y) \ (z \ x)"
by (metis distr law19 law26 law27 law31 lawP lawX)
lemma (in ax12345) law21: (* Law c/21, weak commutativity *)
shows "x \ y \ x \ z = x \ z \ x \ y"
by (metis dbmin empty law30 law7 lawF lawb)
lemma (in ax12345) law25: (* Law d/25, partitioning *)
shows "x \ y \ x \ y = x"
by (metis law30 law31 restri)
lemma (in ax12345) law6: (* Law e/6, empty domain *)
shows "x \ y \ y = e"
by (metis empty law19 restri)
lemma (in ax12345) lawf: (* Law f/ *)
shows "(x \ y \ z) \ (y \ x) = x \ z \ (y \ x)"
by (metis distr law18 lawO lawb swap)
lemma (in ax12345) law11: (* Law g/11, associativity *)
shows "x \ (y \ z) = x \ y \ z"
by (metis distr idemp law18 law26 law27 law30 law31 law7 law9 lawG lawI lawJ lawQ lawb lawf)
lemma (in ax12345) lawh: (* Law h/ *)
shows "x \ y \ z = x \ (x \ y) \ (x \ z)"
by (metis law19 lawP restri)
lemma (in ax12345) law22: (* Law i/22, weak commutativity *)
shows "x \ y \ z = x \ z \ y"
by (metis law19 lawP restri)
lemma (in ax12345) lawj: (* Law j/ *)
shows "x \ (y \ z) = x \ z \ x \ y"
by (metis dbmin law21 restri)
lemma (in ax12345) lawk: (* Law k/ *)
shows "x \ y \ x \ z = x \ (y \ (x \ z))"
by (metis law21 law30 lawb)
lemma (in ax12345) lawl: (* Law l/ *)
shows "x \ y \ x \ z = x \ y \ z"
by (metis dbmin law26 law27 lawO lawa lawj lawk restri)
lemma (in ax12345) law23: (* Law m/23, weak commutativity *)
shows "x \ y \ z = x \ z \ y"
by (metis law21 lawk lawl restri)
lemma (in ax12345) law12: (* Law n/12, associativity *)
shows "x \ (y \ z) = x \ y \ z"
by (metis law19 law21 law26 lawP lawa lawj lawk lawl restri)
lemma (in ax12345) law14: (* Law o/14, distributivity *)
shows "(x \ y) \ z = x \ z \ y \ z"
proof -
from restri[where g=z] have "(x \ y) \ z = (x \ y) \ ((x \ y) \ z)"
by simp
also have "\ = (x \ y) \ (x \ z \ y \ z)"
by (metis distr)
also have "\ = x \ (y \ z) \ (x \ z) \ y \ (x \ z) \ (y \ z)"
by (metis distr law19 law26)
also have "\ = (x \ (x \ z) \ x \ y) \ (x \ z) \ (y \ (y \ z) \ y \ x) \ (y \ z)"
by (metis lawj restri)
also have "\ = x \ (x \ z) \ x \ (x \ z) \ y \ (y \ (y \ z) \ y \ (y \ z) \ x)"
by (metis distr lawO law19)
also have "\ = x \ (x \ z) \ y \ (y \ z)"
by (metis law29 restri)
also have "\ = x \ z \ y \ z"
by (metis restri)
finally show ?thesis by simp
qed
lemma (in ax12345) law15: (* Law p/15, distributivity *)
shows "x \ (y \ z) = x \ y \ x \ z"
by (metis law19 law26 lawj lawk restri)
lemma (in ax12345) law16: (* Law q/16, distributivity *)
shows "x \ y \ z = (x \ z) \ (y \ z)"
by (metis law19 law26 lawP lawa lawj lawk restri)
lemma (in ax12345) law17: (* Law r/17, distributivity *)
shows "x \ y \ z = (x \ y) \ (x \ z)"
by (metis law19 law26 lawF lawb restri)
lemma (in ax12345) law32: (* Law s/32, reordering *)
shows "(x \ y) \ z = x \