Skip to content

Instantly share code, notes, and snippets.

View pavly-gerges's full-sized avatar
🤖
Electrostat Lab.

Pavly Gerges (pavl_g) pavly-gerges

🤖
Electrostat Lab.
View GitHub Profile
@pavly-gerges
pavly-gerges / states-and-invariants.md
Last active March 27, 2025 19:14
States and invariance in discrete mathematical structures and computing.

States and Invariants

  • State: A state describes discrete change in the activity of a system on the physical electrical or the quantum level or the virtual level.
  • Invariant: A predicate (or property) that is perserved for each state across the states chain under all state transitions; that is P(v) is true for all the members of the set of labeled arcs or in Automata Theory the set of delta functions $$\Delta$$ representing the state transitions in an Automaton.

Important

Theorems required to prove:

  1. image

  2. image

@pavly-gerges
pavly-gerges / refactor-tree.md
Last active April 10, 2025 10:13
Refactor a snippet taken from C How to program by Deitels to a better production code.

Specification for refactoring an example function:

Important

Functions Declarations and Type Defintions Definition
image image

The main quest is to find problems in this code, classify them, and refactor them accordingly. Follow the software specification to understand what are the problems of this code, why they are problems, and whether there is a refactor.

Here is an example of a non-null terminated list:

#include <stdio.h>
#include <stddef.h>

typedef struct buffer (buffer);

struct buffer {
    void *start_address;
 void *end_address;