Skip to content

Commit

Permalink
refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
josd committed Jan 14, 2025
1 parent b464c4c commit ec3484a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion reasoning/age-zkp-surfaces/age-zkp.n3s
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
) log:ifThenElseIn (_:Context -1).
}.

# Challenger checking the proof using the hash
# verifier checking the proof using the hash
( _:Name
_:Result
_:Hash
Expand Down
2 changes: 1 addition & 1 deletion reasoning/age-zkp/age-zkp.n3
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
) log:ifThenElseIn (?Context -1).
}.

# Challenger checking the proof using the hash
# verifier checking the proof using the hash
{ :simulation1 :challengeProof (?Name ?Result ?Hash) } <= {
?Name :birthDay ?BirthDay.
:simulation1 :date ?Date.
Expand Down
16 changes: 8 additions & 8 deletions reasoning/graph-3-coloring-surfaces/graph-3-coloring.n3s
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
:prover_response a log:Component.
:verify_response a log:Component.

# Graph definition
# graph definition
:a :edge :b.
:b :edge :c.
:c :edge :d.
Expand All @@ -19,12 +19,12 @@
:a :edge :c.
:b :edge :d.

# List of allowed colors
# list of allowed colors
true :color :red.
true :color :blue.
true :color :green.

# Check if a coloring is valid for the entire graph (no two connected nodes have the same color)
# check if a coloring is valid for the entire graph (no two connected nodes have the same color)
true :valid_coloring ().
(_:L _:NC _:Rest _:SCOPE) log:onNegativeSurface {
() log:onNegativeSurface {
Expand All @@ -35,7 +35,7 @@ true :valid_coloring ().
true :valid_coloring _:Rest.
}.

# Conflict check: verifies if neighbors have the same color
# conflict check: verifies if neighbors have the same color
(_:Node _:Color _:L _:Neighbor _:Any) log:onNegativeSurface {
() log:onNegativeSurface {
(_:Node _:Color) :conflict _:L.
Expand All @@ -55,7 +55,7 @@ true :valid_coloring ().
# Alice's secret valid coloring
true :alice_knows_coloring ((:a :red) (:b :blue) (:c :green) (:d :red) (:e :blue)).

# Prover generates a permuted version of the coloring (hides actual colors)
# prover generates a permuted version of the coloring (hides actual colors)
(_:PermutedColoring _:SecretColoring) log:onNegativeSurface {
() log:onNegativeSurface {
true :permuted_coloring _:PermutedColoring.
Expand All @@ -64,15 +64,15 @@ true :alice_knows_coloring ((:a :red) (:b :blue) (:c :green) (:d :red) (:e :blue
_:SecretColoring list:permutation _:PermutedColoring.
}.

# Verifier issues a random edge as a challenge
# verifier issues a random edge as a challenge
(_:X _:Y) log:onNegativeSurface {
() log:onNegativeSurface {
true :challenge_edge (_:X _:Y).
}.
_:X :edge _:Y.
}.

# Prover reveals colors for the challenged edge only
# prover reveals colors for the challenged edge only
(_:X _:Y _:PermutedColoring _:ColorX _:ColorY) log:onNegativeSurface {
() log:onNegativeSurface {
((_:X _:Y) _:PermutedColoring) :prover_response ((_:X _:ColorX) (_:Y _:ColorY)).
Expand All @@ -81,7 +81,7 @@ true :alice_knows_coloring ((:a :red) (:b :blue) (:c :green) (:d :red) (:e :blue
_:PermutedColoring list:member (_:Y _:ColorY).
}.

# Verifier checks if revealed colors are different for the challenged edge
# verifier checks if revealed colors are different for the challenged edge
(_:X _:ColorX _:Y _:ColorY _:Result _:SCOPE) log:onNegativeSurface {
() log:onNegativeSurface {
((_:X _:ColorX) (_:Y _:ColorY)) :verify_response _:Result.
Expand Down
16 changes: 8 additions & 8 deletions reasoning/graph-3-coloring/graph-3-coloring.n3
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix : <http://example.org/#>.

# Graph definition
# graph definition
:a :edge :b.
:b :edge :c.
:c :edge :d.
Expand All @@ -11,20 +11,20 @@
:a :edge :c.
:b :edge :d.

# List of allowed colors
# list of allowed colors
true :color :red.
true :color :blue.
true :color :green.

# Check if a coloring is valid for the entire graph (no two connected nodes have the same color)
# check if a coloring is valid for the entire graph (no two connected nodes have the same color)
true :valid_coloring ().
{ true :valid_coloring ?L } <= {
?L list:firstRest (?NC ?Rest).
({ ?NC :conflict ?Rest } false true) log:ifThenElseIn (?SCOPE -1).
true :valid_coloring ?Rest.
}.

# Conflict check: verifies if neighbors have the same color
# conflict check: verifies if neighbors have the same color
{ (?Node ?Color) :conflict ?L } <= {
?L list:firstRest ((?Neighbor ?Color) ?Any).
?Noded :edge ?Neighbor.
Expand All @@ -37,24 +37,24 @@ true :valid_coloring ().
# Alice's secret valid coloring
true :alice_knows_coloring ((:a :red) (:b :blue) (:c :green) (:d :red) (:e :blue)).

# Prover generates a permuted version of the coloring (hides actual colors)
# prover generates a permuted version of the coloring (hides actual colors)
{ true :permuted_coloring ?PermutedColoring } <= {
true :alice_knows_coloring ?SecretColoring.
?SecretColoring list:permutation ?PermutedColoring.
}.

# Verifier issues a random edge as a challenge
# verifier issues a random edge as a challenge
{ true :challenge_edge (?X ?Y) } <= {
?X :edge ?Y.
}.

# Prover reveals colors for the challenged edge only
# prover reveals colors for the challenged edge only
{ ((?X ?Y) ?PermutedColoring) :prover_response ((?X ?ColorX) (?Y ?ColorY)) } <= {
?PermutedColoring list:member (?X ?ColorX).
?PermutedColoring list:member (?Y ?ColorY).
}.

# Verifier checks if revealed colors are different for the challenged edge
# verifier checks if revealed colors are different for the challenged edge
{ ((?X ?ColorX) (?Y ?ColorY)) :verify_response ?Result } <= {
({ ?ColorX log:notEqualTo ?ColorY } { ?Result log:equalTo :valid } { ?Result log:equalTo :invalid }) log:ifThenElseIn (?SCOPE -1).
}.

0 comments on commit ec3484a

Please sign in to comment.