(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
Require Export DistributedReferenceCounting.machine3.invariant0.
Require Export DistributedReferenceCounting.machine3.invariant1.
Require Export DistributedReferenceCounting.machine3.invariant2.
Unset Standard Proposition Elimination Names.
(* Where properties of rooted_fun are derived --> this should obviously be abstracted and given decent names *)
Section INVARIANT3.

(* Specifications: *)
Lemma sigma_rooted_fun2 :
forall (s s1 s2 : Site) (d : Message),
s2 <> owner -> s1 <> s -> s2 <> s -> rooted_fun s s1 s2 d = 0%Z.
Lemma sigma_rooted_fun3 :
forall s1 : Site,
sigma_but Site owner eq_site_dec LS
(fun s : Site => rooted_fun s s1 owner dec) = 0%Z.
Lemma sigma_rooted_fun4 :
forall (s s1 : Site) (l : list Site),
~ In s l ->
sigma_but Site owner eq_site_dec l
(fun s0 : Site => rooted_fun s0 s1 owner (inc_dec s)) = 0%Z.
Lemma sigma_rooted_fun6 :
forall (s s1 : Site) (l : list Site),
~ In s l ->
sigma_but Site owner eq_site_dec l
(fun s0 : Site => rooted_fun s0 s owner copy) = 0%Z.
Lemma sigma_rooted_fun7 :
forall (s : Site) (l : list Site),
only_once Site eq_site_dec s l ->
s <> owner ->
sigma_but Site owner eq_site_dec l
(fun s0 : Site => rooted_fun s0 s owner copy) = 1%Z.
Lemma sigma_rooted_fun8 :
forall (s2 : Site) (l : list Site),
~ In s2 l ->
sigma_but Site owner eq_site_dec l
(fun s : Site => rooted_fun s owner s2 dec) = 0%Z.
Lemma sigma_rooted_fun9 :
forall (s2 : Site) (l : list Site),
only_once Site eq_site_dec s2 l ->
s2 <> owner ->
sigma_but Site owner eq_site_dec l
(fun s : Site => rooted_fun s owner s2 dec) = 1%Z.
Lemma sigma_rooted_fun10 :
forall s2 : Site,
sigma_but Site owner eq_site_dec LS
(fun s : Site => rooted_fun s owner s2 copy) = 0%Z.
Lemma sigma_rooted_fun11 :
forall (s1 s2 : Site) (l : list Site),
s2 <> owner ->
s1 <> owner ->
~ In s2 l ->
sigma_but Site owner eq_site_dec l (fun s : Site => rooted_fun s s1 s2 dec) =
0%Z.
Lemma sigma_rooted_fun12 :
forall s1 s2 : Site,
s2 <> owner ->
s1 <> owner ->
only_once Site eq_site_dec s2 LS ->
sigma_but Site owner eq_site_dec LS (fun s : Site => rooted_fun s s1 s2 dec) =
1%Z.
Lemma sigma_rooted_fun13 :
forall (s1 s2 : Site) (l : list Site),
s2 <> owner ->
s1 <> owner ->
~ In s1 l ->
sigma_but Site owner eq_site_dec l (fun s : Site => rooted_fun s s1 s2 copy) =
0%Z.
Lemma sigma_rooted_fun14 :
forall (s1 s2 : Site) (l : list Site),
s2 <> owner ->
s1 <> owner ->
only_once Site eq_site_dec s1 l ->
sigma_but Site owner eq_site_dec l (fun s : Site => rooted_fun s s1 s2 copy) =
1%Z.
Lemma sigma_rooted_fun5 :
forall s s1 : Site,
only_once Site eq_site_dec s LS ->
s <> owner ->
sigma_but Site owner eq_site_dec LS
(fun s0 : Site => rooted_fun s0 s1 owner (inc_dec s)) = 1%Z.
Lemma sigma_rooted_fun1 :
forall (s s1 s2 : Site) (d : Message),
s2 <> owner ->
~ In s1 LS ->
~ In s2 LS ->
sigma_but Site owner eq_site_dec LS (fun s : Site => rooted_fun s s1 s2 d) =
0%Z.
Lemma add_reduce4 :
forall x y z a : Z, (x + y)%Z = (z + a)%Z -> (x - a)%Z = (z - y)%Z.
Lemma add_reduce5 :
forall x y z a : Z, (x - a)%Z = (z - y)%Z -> x = (a + z - y)%Z.
Lemma add_reduce6 : forall x y z : Z, x = (z + y)%Z -> (x - z)%Z = y.
End INVARIANT3.